View Code of Problem 89

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	char s[1010];
	gets(s);
	for(int i = 0;i < strlen(s);i++){
		if(s[i]=='Y') break;
		else if(s[i]=='M') printf("Monday\n");
		else if(s[i]=='T'&&s[i+1]=='u'){
			printf("Tuesday\n");
			i++;
		}else if(s[i]=='T'&&s[i+1]=='h'){
			printf("Thursday");
			i++;
		}else if(s[i]=='W'){
			printf("Wednesday\n");
		}else if(s[i]=='F'){
			printf("Friday\n");
		}else if(s[i]=='S'&&s[i+1]=='a'){
			printf("Saturday\n");
			i++;
		}else if(s[i]=='S'&&s[i+1]=='u'){
			printf("Sunday\n");
			i++;
		}else{
			printf("Wrong data\n");
		}
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 89