Advertisement
skb50bd

UVa 12243 Flowers Flourish from France

Aug 28th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.     string line;
  7.     char cs, cc;
  8.     bool flag;
  9.     while(true) {
  10.         getline(cin, line);
  11.         if(line[0] == '*') break;
  12.         flag = true;
  13.         (line[0] > 64 && line[0] < 91) ? cc = line[0], cs = cc + 32 : cs = line[0], cc = cs - 32;
  14.         for(int i = 0; line[i]; i++)
  15.             if(line[i] == ' ')
  16.                 if(line[i + 1] != cs && line[i + 1] != cc) {
  17.                     flag = false;
  18.                     break;
  19.                 }
  20.         flag ? cout << "Y" << endl : cout << "N" << endl;
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement