I'm new to programming and trying to write a script that outputs a line containing pangram if the input s is a pangram, or otherwise not pangram. When I compile the script I get an error "reached end of file while parsing." I believe I have balanced parenthesis. Any help would be greatly appreciated.
import java.util.*;
class Main {
public static void main(String[] args) {
boolean flag = false;
Scanner key = new Scanner(System.in);
String s = key.nextLine();
String upperCaseStr = s.toUpperCase();
for(char alphabet = 'A'; alphabet <='Z'; alphabet++) {
if(upperCaseStr.indexOf(alphabet)==-1){
flag=true;
break;
}
}
if (flag){
System.out.print("not ");
}
System.out.println("pangram");
}
}
Aucun commentaire:
Enregistrer un commentaire