View Code of Problem 89

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int i;
	while(getline(cin,s)){
		for(i=0;i<s.length();i++){
			if(s[i]=='Y'){
				break;
			}
			else if(s[i]=='M'){
				cout<<"Monday"<<endl;
			}
			else if(s[i]=='T'){
				if(s[i+1]=='u'){
					cout<<"Tuesday"<<endl;
				}
				else if(s[i+1]=='h'){
					cout<<"Thursday"<<endl;
				}
				else{
					cout<<"Wrong data"<<endl;
				}
			}
			else if(s[i]=='W'){
				cout<<"Wednesday"<<endl;
			}
			else if(s[i]=='F'){
				cout<<"Firday"<<endl;
			}
			else if(s[i]=='S'){
				if(s[i+1]=='a'){
					cout<<"Saturday"<<endl;
				}
				else if(s[i+1]=='u'){
					cout<<"Sunday"<<endl;
				}
				else{
					cout<<"Wrong data"<<endl;
				}
			}
			else{
				cout<<"Wrong data"<<endl;
			}	
		}	
	}
}

Double click to view unformatted code.


Back to problem 89