It tells me that the String could be split with more than one space. How can i archieve this?
package de.codegym.task.task08.task0823;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Landesweite Restaurantkette
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
//schreib hier deinen Code
String sub[]=s.split(" ");
for(int i=0; i<sub.length;i++){
System.out.print(sub[i].substring(0, 1).toUpperCase() + sub[i].substring(1)) ;
if(i!=sub.length-1){
System.out.print(" ") ;
}
}
}
}