pat shermes dating

 
 

Detective Holmes receives a strange note: "Let's go on a date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". The big detective quickly understood that the strange garbled characters on the note were actually the date time "Thursday 14:04", because the first pair of the same uppercase English letters (case sensitive) in the previous two strings was the fourth one The letter 'D' stands for Thursday; the second pair of identical characters is 'E', which is the fifth English letter, representing the 14th hour of the day (so from 0:00 to 23:00 of the day from the numbers 0 to 9, and capital letters A to N); the first pair of the same English letter 's' in the following two strings appears in the 4th position (counting from 0), representing the 4th minute. Now, given two pairs of strings, please help Sherlock Holmes to decode and get the date of the date.

Input format:

The input gives 4 strings that are not empty, contain no spaces, and have a length of no more than 60 in each of 4 lines.

Output format:

Output the time of the appointment in one line in the format "DAY HH:MM", where "DAY" is the 3-character abbreviation of the week, i.e. MON for Monday, TUE for Tuesday, WED for Wednesday, THU for Thursday, and FRI for Friday , SAT means Saturday, SUN means Sunday. Item input guarantees that a unique solution exists for each test.

Input sample:
3485djDkxh4hhGE
2984akDfkkkkggEdsb
s&hgsfdk
d&Hyscvnm
Sample output:
COLLECTION 14:04

#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
	string Week[7] = {"MON","TUE","WEN","THU","FRI","SAT","SUN"};
	char fir[100],sec[100],thr[100],four[100];
	int i,j,cc = 1;

	cin>>fir>>sec>>thr>>four;
	
	int min = strlen (fir);
	int tt = strlen(sec);
	if (min> tt) min = tt;
	for(i=0;i<min;i++){
		if((fir[i]>='A'&&fir[i]<='G') && fir[i] == sec[i] && cc==1){
			cout<<Week[fir[i]-'A']<<" ";  cc=2;
		}
		else if((fir[i]<='9'&&fir[i]>='0'&&fir[i] == sec[i] && cc==2)
			     ||(fir[i]<='N' && fir[i]>='A'&&fir[i] == sec[i] && cc==2)){
			if(fir[i]<='9'&&fir[i]>='0') {
				cout<<"0"<<fir[i]-'0'<<':'; break;
			}			
			else if(fir[i]<='N' && fir[i]>='A'){
				cout<<fir[i]-'A'+10<<':'; break;
			}
		}	
	}	
	min = strlen(thr);
	tt = strlen(four);
	if (min> tt) min = tt;
	for(i=0;i<min;i++){
		if((thr[i]>='A'&&thr[i]<='Z'&&thr[i] == four[i])||
		(thr[i]>='a'&&thr[i]<='z')&&thr[i] == four[i]){
			if(i<9){
				cout<<"0"<<i<<endl;
			}else cout<<i<<endl;
			break;	
		}
	}
	return 0;
}
I don't know why there is a place that has been unable to pass, to be investigated

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326886710&siteId=291194637