福尔摩斯的约会

import java.util.Scanner;

public class Main {
    private final static String[] DAY = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        Scanner in = new Scanner(System.in);
        String l1 = in.nextLine();
        String l2 = in.nextLine();
        String l3 = in.nextLine();
        String l4 = in.nextLine();
        int len1 = Math.min(l1.length(), l2.length());
        int len2 = Math.min(l3.length(), l4.length());
        boolean flag1 = true;
         
        for(int i = 0;i<len1;i++){
            char c = l1.charAt(i);
            if(flag1&&c>='A'&&c<='G'){
                if(c==l2.charAt(i)){
                    flag1 = !flag1;
                    System.out.print(DAY[c-65]+" ");
                }
            }else if (!flag1&&c==l2.charAt(i)) {
                if(c>='0'&&c<='9'){
                    System.out.print("0"+c+":");
                    break;
                }else if (c>='A'&&c<='N') {
                    System.out.print((c-55)+":");
                    break;
                }
            }
        }
         
        for(int i = 0;i<len2;i++){
            char c = l3.charAt(i);
            if(c>='a'&&c<='z'&&c==l4.charAt(i)){
                if(i<10)
                    System.out.print("0"+i);
                else
                    System.out.print(i);
                break;
            }
        }
        in.close();
    }
 
}
posted @ 2018-11-09 19:46  DianaLee  阅读(128)  评论(0编辑  收藏  举报