Skip to content

Instantly share code, notes, and snippets.

@MohamedTaha98
Created July 27, 2017 06:28
Show Gist options
  • Save MohamedTaha98/725aa6459ad8e70814d26b2f8257c45e to your computer and use it in GitHub Desktop.
Save MohamedTaha98/725aa6459ad8e70814d26b2f8257c45e to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Taha {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
String s = in.next();
if (s.charAt(0) == 'a' || s.charAt(0) == 'h') {
if (s.charAt(1) == '1' || s.charAt(1) == '8')
System.out.println("3");
else
System.out.println("5");
}
else if (s.charAt(1) == '1' || s.charAt(1) == '8') {
if (s.charAt(0) == 'a' || s.charAt(0) == 'h')
System.out.println("3");
else
System.out.println("5");
}
else
System.out.println("8");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment