Created
July 27, 2017 06:28
-
-
Save MohamedTaha98/725aa6459ad8e70814d26b2f8257c45e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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