1014. Sherlock Holmes's date (20)

Source: Internet
Author: User

Sherlock Holmes received a strange note: "Let's date!" 3485djdkxh4hhge 2984AKDFKKKKGGEDSB s&hgsfdk d&hyscvnm ". The big detective soon understood, the note on the strange garbled is actually the date of the time "Thursday 14:04", because the first two strings in the same uppercase English letter (case sensitivity) is the 4th letter ' D ', for Thursday, 2nd to the same character is ' E ', that is the 5th of the English alphabet, Represents the 14 head of the day (so that the day's 0 to 23 points are represented by the numbers 0 through 9, and the uppercase A through n); the next two string 1th to the same English letter ' s ' appears in the 4th position (counting from 0), representing the first 4 minutes. Now given two pairs of strings, please help Sherlock Holmes decode the time to get the appointment.

Input format:

The input gives 4 non-empty, space-free, and 60-length strings in 4 rows.

Output format:

The time to output an appointment in a single row, in the form "Day hh:mm", where "days" is a 3-character abbreviation for a week, that is, Mon for Monday, Tue for Tuesday, Wed for Wednesday, Thu for Thursday, Fri for Friday, sat for Saturday, and sun for Sunday. The topic input guarantees that each test has a unique solution.

Input Sample:
3485djdkxh4hhge 2984AKDFKKKKGGEDSB S&HGSFDK d&hyscvnm
Sample output:
THU 14:04

#include <stdlib.h>int main () {char str[4][61];    scanf ("%s%s%s%s", str[0],str[1],str[2],str[3]);    int flag1 = 0,flag2=0;    int i; for (i=0; str[0][i]!= ' &&str[1][i]!= '; i++) {if (flag1==0&&str[0][i]>= ' A ' &&str[0]            [i]<= ' G ' &&str[0][i]==str[1][i]) {flag1=1;            Flag2=1;            if (str[0][i]== ' A ') printf ("MON");            else if (str[0][i]== ' B ') printf ("TUE");            else if (str[0][i]== ' C ') printf ("WED");            else if (str[0][i]== ' D ') printf ("THU");            else if (str[0][i]== ' E ') printf ("FRI");            else if (str[0][i]== ' F ') printf ("SAT");           else if (str[0][i]== ' G ') printf ("SUN");        Continue            } if (Flag2==1&&str[0][i]==str[1][i]) {if (str[0][i]>= ' 0 ' &&str[0][i]<= ' 9 ') {PrinTF ("%02d:", str[0][i]-' 0 ');            Break                }else if (str[0][i]>= ' A ' &&str[0][i]<= ' N ') {printf ("%02d:", str[0][i]-55);            Break }}} for (i=0; str[2][i]!= ' &&str[3][i]!= '); i++) {if (str[2][i]==str[3][i]&& (str[ 2][i]>= ' a ' &&str[2][i]<= ' z ') | | (str[2][i]>= ' A ' &&str[2][i]<= ' Z ')))            {printf ("%02d", I);        Break }} return 0;}

1014. Sherlock Holmes's date (20)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.