I run and every thing is fine, but it is not working. Can someone please help me fix my code? I don't know what is wrong. Thanks!
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();
String[] arr = s.split("\\s+");
String phrase = "";
for (int i = 0; i < arr.length-1; i++) {
phrase += Character.toUpperCase(arr[i].charAt(0));
for (int j = 1; j < arr[i].length(); j++) {
phrase +=arr[i].charAt(j);
}
phrase += " ";
}
phrase += (Character.toUpperCase(arr[arr.length-1].charAt(0)));
for (int j = 1; j < arr[arr.length-1].length(); j++) {
phrase += (arr[arr.length-1].charAt(j));
}
System.out.println(phrase);
}
}