Ad

Write a function that will check if two given characters are the same case.

If either of the characters is not a letter, return -1
If both characters are the same case, return 1
If both characters are letters, but not the same case, return 0
Examples
'a' and 'g' returns 1

'A' and 'C' returns 1

'b' and 'G' returns 0

'B' and 'g' returns 0

'0' and '?' returns -1

public class Kata {
  public static int SameCase(char a, char b) {
    
    string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char tempA = a;
    char tempB = b;
    if((!letters.Contains(tempA = char.ToUpper(tempA)) && letters.Contains(tempB = char.ToUpper(tempB))) || 
       (!letters.Contains(tempB = char.ToUpper(tempB)) && letters.Contains(tempA = char.ToUpper(tempA))) ||   
       (!letters.Contains(tempA = char.ToUpper(tempA)) && !letters.Contains(tempB = char.ToUpper(tempB)))) return -1;
    if(char.IsUpper(a) && char.IsUpper(b)){
      return 1;
    } else if (char.IsLower(a) && char.IsLower(b)){
      return 1;
    } else {
      return 0;
    }
  }
}