Basic code for input a series of strings. I trying to use it but this never ends and my solution is not getting printed. What possibly am I doing wrong ?
while (S.hasNext()) {
String s = S.next();
int max = 0;
for (int i = 0; i < s.length(); i++) {
if (Character.isUpperCase(s.charAt(i))) {
max++;
}
}
if (max > curr) {
curr = max;
}
}
System.out.println(curr);