Skip to content

Instantly share code, notes, and snippets.

@Dav1dde
Created April 26, 2013 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dav1dde/5469294 to your computer and use it in GitHub Desktop.
Save Dav1dde/5469294 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class AsciiShop01 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int last_length = -1;
int overall = 0;
for(;scanner.hasNextLine();overall++) {
String line = scanner.nextLine();
if(last_length == -1)
last_length = line.length();
else if(last_length != line.length()) {
System.out.println("INPUT MISMATCH");
return;
}
}
System.out.printf("%d %d\n", last_length, overall);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment