My program does exactly what is asked. I even checked to make sure there is no space added after. Is it because I am not converting the String, and I am instead, printing out the array?
package com.codegym.task.task08.task0823;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
/*
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();
char[] string = s.toCharArray();
int b = string[0] - 32;
string[0] = (char) b;
//System.out.print(string[0]);
for(int i = 1; i < string.length; i++){
if(string[i] == 32) {
b = i;
int x = string[b + 1] - 32;
string[b + 1] = (char) x;
i++;
}
}
for(int i = 0; i < string.length; i++){
System.out.print(string[i]);
}
//System.out.print("hey");
}
}