import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb = new StringBuffer("");
String m = "";
while (true) {
m = br.readLine();
if (m.equals("*")) {
break;
}
StringTokenizer st = new StringTokenizer(m);
char tempU = 0, tempL = 0;
Boolean can = true;
int n = st.countTokens();
for (int i = 0; i < n; i++) {
char temp = st.nextToken().charAt(0);
if (i == 0) {
if (temp > 96) {
tempL = temp;
tempU = (char) (temp - 32);
} else {
tempL = (char) (temp + 32);
tempU = temp;
}
} else {
if (temp != tempU && temp != tempL) {
can = false;
break;
}
}
}
if (can) {
sb.append("Y\n");
} else {
sb.append("N\n");
}
}
System.out.print(sb);
}
}
No comments:
Post a Comment