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
It is crucial to see the conditions.
Day conditions: Letters between A and g;
Conditions for HH: Letters from 0 to 9,a to N;
MM Conditions: Letters from A to Z,a to Z;
1#include <stdio.h>2#include <string.h>3#include <math.h>4 intMain () {5 Chara[ -];6 Chara1[ -];7 Charb[ -];8 Charb1[ -];9 gets (a);Ten gets (A1); One gets (b); A gets (B1); - intLena,lenb; - intday,hh,mm; the if(Strlen (a) <=strlen (A1)) -Lena =strlen (a); - Else -Lena =strlen (A1); + if(strlen (b) <=strlen (B1)) -LenB =strlen (b); + Else ALenB =strlen (B1); at intKa=1; - intkb=1; - for(intI=0; i<lena;i++){ - if(a[i]==a1[i]&&ka==1){ - if(a[i]<='G'&&a[i]>='A'){ -Day = a[i]-'A'; inka++; - Continue; to } + } - if(a[i]==a1[i]&&ka==2){ the if(a[i]<='N'&&a[i]>='A'|| a[i]<='9'&&a[i]>='0'){ * if(a[i]<='Z'&&a[i]>='A'){ $HH = a[i]-'A'+1;Panax NotoginsengHH = hh+9; - } the + Else{ AHH = a[i]-'0'; the } + - Break; $ } $ } - - } the for(intI=0; i<lenb;i++){ - if(b[i]==B1[i]) {Wuyi if(b[i]<='Z'&&b[i]>='A'|| b[i]<='Z'&&b[i]>='a'){ theMM =i; - Break; Wu } - } About } $ Charday1[][4]={"MON","TUE","WED","THU","FRI","SAT","SUN"}; -printf"%s", Day1[day]); -printf"%02d:%02d", hh,mm); -}
PAT 1014. Sherlock Holmes's date (20)