import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s1 = sc.nextLine();
String s2 = sc.nextLine();
boolean flag1 = check(s1);
boolean flag2 = check(s2);
if (flag1 && flag2) {
System.out.print("Either is ok!");
return;
}
if(flag1&& !flag2){
System.out.print(s1+" for sure!");
return;
}
if(flag2 && !flag1){
System.out.print(s2+" for sure!");
}
else {
System.out.print("Try again!");
}
}
public static boolean check(String s) {
String cur=s.toLowerCase();
String pattern = "rioi";
return test(cur,pattern);
}
private static boolean test(String cur, String pattern) {
if (cur == null) {
return false;
}
if (pattern == null) {
return true;
}
int j=0;
for (int i = 0; i < cur.length(); i++) {
if (cur.charAt(i) == pattern.charAt(j)) {
j++;
} if(j==pattern.length()) {
return true;
}
}
return false;
}
}
为什么我只有20分,测试都对的呀