Could you please help me to find which scenario I am missing here?
It seems to work wit different number of spaces but still it doesn't pass.
package com.codegym.task.task08.task0823;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Going national
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
s = s.toLowerCase();
char[] text = s.toCharArray();
char space = ' ';
if (text[0] != space) {
text[0] -= 32;
}
for (int i = 1; i < text.length; i++) {
if (text[i - 1] == space) {
if (text[i] == space) {
continue;
}
text[i] -= 32;
}
}
System.out.println(text);
//write your code here
}
}