pat-B-1014. Sherlock Holmes's date (20)

Source: Internet
Author: User

1014. Sherlock Holmes's appointment (20) time limit of MS memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, Yue

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
Reminder: Not all uppercase letters match
1#include <iostream>2#include <string.h>3#include <cstdio>4#include <algorithm>5 using namespacestd;6 intMain ()7 {8     Chars[4][ A];9     stringday[]= {"MON","TUE","WED","THU","FRI","SAT","SUN"};Ten     intI=0, j=0; One     BOOLfirst=true; A      for(i=0; i<4; i++) -Cin>>S[i]; -      for(i=0; s[0][i]&&s[1][i]; i++) the     { -         if(First && s[0][i]>='A'&&s[0][i]<='G'&& s[0][i]==s[1][i])//do not use Isupper () here! -         { -cout<<day[s[0][i]-'A']<<" "; +first=false; -             Continue; +         } A  at         if(!first && s[0][i]==s[1][i] && (s[0][i]>='A'&&s[0][i]<='N'|| IsDigit (s[0][i])))//do not use Isupper () here! -         { -             if(Isupper (s[0][i])) -cout<<s[0][i]-'A'+Ten<<":"; -             if(IsDigit (s[0][i])) -cout<<"0"<<s[0][i]-'0'<<":"; in              Break; -         } to     } +  -      for(i=0; s[2][i] && s[3][i]; i++) the     { *         if(Isalpha (s[2][i]) && s[2][i]==s[3][i]) $         {Panax Notoginsengcout<<i/Ten<<i%Ten<<Endl; -              Break; the         } +     } A  the     return 0; +}

pat-B-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.