Hi:) I've tried to solve this task with substring.. It works and the output is correct, but CodeGym doesn't let me to pass this task. Could anyone explain me why?
package pl.codegym.task.task08.task0823;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Ruszamy na cały kraj
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
//tutaj wpisz swój kod
String spacja = "";
String[] tab = s.split(" ");
for(String ss : tab){
String first = ss.substring(0,1);
first = first.toUpperCase();
spacja+=first+ss.substring(1) + " ";}
System.out.println(spacja);
}
}