1014 福尔摩斯的约会

题目 

#include 
char a[65], b[65], c[65], d[65];
char *week[] = { "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN" };
int main() {
	while( ~scanf( "%s%s%s%s", a, b, c, d ) ) {
		int f = 1;
		for( int i = 0; a[i] != '\0' && b[i] != '\0'; i++ ) {
			if( a[i] == b[i] ) {
				if( f ) {
					if( a[i] >= 'A' && a[i] <= 'G' ) {
						printf( "%s ", week[a[i] - 'A'] );
						f = 0;
					}
				} else {
					if( ( a[i] >= 'A' && a[i] <= 'N' ) || ( a[i] >= '0' && a[i] <= '9' ) ) {
						int num;
						if( a[i] >= '0' && a[i] <= '9' ) {
							num = a[i] - '0';
							putchar( '0' );
						} else    num = a[i] - 'A' + 10;
						printf( "%d:", num );
						break;
					}
				}
			}
		}
		for( int i = 0; c[i] != '\0' && d[i] != '\0'; i++ ) {
			if( c[i] == d[i] ) {
				if( ( c[i] >= 'A' && c[i] <= 'Z' ) || ( c[i] >= 'a' && c[i] <= 'z' ) ) {
					printf( "%02d\n", i );
					break;
				}
			}
		}
	}
	return 0;
}

 

你可能感兴趣的:(练习,1014,福尔摩斯的约会)