Given two cells on the standard chess board, determine whether they have the same color or not.

Example

Input/Output

풀이

boolean solution(String cell1, String cell2) {
    char c1 = cell1.charAt(0);
    char c2 = cell2.charAt(0);
    
    int n1 = Integer.parseInt(cell1.substring(1));
    int n2 = Integer.parseInt(cell2.substring(1));
    
    int result = Math.abs(c1 - c2) + Math.abs(n1 - n2);
    
    if (result % 2 > 0) return false;
    else return true;
}