The program DOES change the first letter of each word to uppercase but compiler says it does NOT. Please help
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();
//write your code here
String[] splitArray = s.split(" ");
String result = "";
for (int i = 0; i < splitArray.length; i++) {
String temp = splitArray[i];
temp = temp.replaceFirst(temp.substring(0, 1), temp.substring(0, 1).toUpperCase());
result += temp + " ";
//System.out.println(temp);
}
result = result.substring(0, (result.length()-1));
System.out.println(result);
}
}