public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
String[] strings = s.trim().split("\\s+");
for (String str: strings){
str = str.substring(0, 1).toUpperCase() + str.substring(1);
System.out.println(str);
}
//write your code here
}
My solution
Archived
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
25 May 2019, 20:20
Next time you ask a question, sue this slider and don't copy + paste code:
.
![]()

0
Guadalupe Gagnon
25 May 2019, 20:21
The only problem in your code that I see is that the output should match the input except that each new word should have the first letter capitalized (not each word on a new line). Fix this and you should be fine.
+2
Ed Maphis
25 May 2019, 20:04
I had to look up a solution for some of the problems on this one.
try
instead of
see if that works better. 0