1014 福尔摩斯的约会

喜夏-厌秋 提交于 2020-01-10 11:16:25
#include <cstdio>
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;
}

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!