Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- char str[5000];
- cin.getline(str,5000);
- while(str[0]!='*')
- {
- char *p=strtok(str," ");
- char f=toupper(str[0]);
- while(p!=NULL)
- {
- if(toupper(*p)!=f)
- break;
- else
- p=strtok(NULL," ");
- }
- if(p!=NULL) //While loop terminated but still words are present in the sentence
- cout<<"N"<<endl;
- else
- cout<<"Y"<<endl;
- cin.getline(str,5000);
- }
- // your code goes here
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment