// Doesn't check for things like trailing white space or blank lines; // need to decide on a length limit for the input string? import java.util.*; public class verify { public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean error = false; String s = in.nextLine(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c < 'A' || c > 'Z') { System.out.println("Bad char in position "+i); error = true; } } if (error) System.exit(1); else System.exit(42); } }