Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     string a;
  6.     while(1)
  7.     {
  8.         int cont=0, x=0, numP=0, letras=0;
  9.         char v[100];
  10.         getline(cin, a);
  11.         for(int i=0; i<a.size(); i++)
  12.         {
  13.             if(a[i]>='a' && a[i]<='z')
  14.             {
  15.                 a[i]=toupper(a[i]);
  16.             }
  17.         }
  18.         if(a == "*") break;
  19.         for(int i=0; i<a.size(); i++)
  20.         {
  21.             cont++;
  22.             if(a[i]==' ')
  23.             {
  24.                 cont = 0;
  25.                 numP++;
  26.             }
  27.             if(cont == 1)
  28.             {
  29.                 if(a[0] == a[i])
  30.                     letras++;
  31.             }
  32.         }
  33.         if(numP+1 == letras)
  34.             cout << "Y" << endl;
  35.         else
  36.             cout << "N" << endl;
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement