class Solution {
public String solution(String s) {
String[] split = s.split("");
split[0] = split[0].toUpperCase();
for(int i = 1; i < split.length; i ++) {
if(split[i-1].equals(" ")) {
split[i] = split[i].toUpperCase();
} else {
split[i] = split[i].toLowerCase();
}
}
return String.join("", split);
}
}