First, the idea
Topic expressed in very general terms.
Requirements Overview:
1, before the two strings, find: a first pair of equal, in the 'A' ~ 'G' in the range of the capital letter
2, the former two strings, the letter position in the back just found, the first found the number or equal to 'a' ~ 'N' letter in the range
3, the two strings, find the first letters of the same (the same lower or upper case);
Second, the code
#include <cstdio>
#include <cctype>
int main()
{
char day[7][4] ={"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"}, str[4][61];
for( int i = 0; i < 4; ++i )
scanf("%s", str[i]);
for( int i = 0, flag = 0, h; str[0][i] != '\0' && str[1][i] !='\0'; ++i )
{
if( !flag && str[0][i] == str[1][i] && str[0][i] >= 'A' && str[0][i] <= 'G' )
{
printf("%s ", day[ str[0][i] - 'A' ]);
++flag;
}
else if( flag && str[0][i] == str[1][i] && ( isdigit( str[0][i] ) || ( str[0][i] >= 'A' && str[0][i] <= 'N' ) ) )
{
if( isdigit( str[0][i] ) )
h = str[0][i] - '0';
else h = str[0][i] - 'A' + 10;
printf("%02d:", h);
break;
}
}
for( int i = 0; str[2][i] != '\2' && str[3][i] !='\2'; ++i )
if( str[2][i] == str[3][i] && isalpha( str[2][i] ) )
{
printf("%02d", i);
return 0;
}
}