Guest User

Untitled

a guest
Feb 6th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4. using namespace std;
  5.  
  6. string getSyl(string Line){
  7.     for(int i=0; i<Line.length(); i++){
  8.         Line[i]=tolower(Line[i]);
  9.     }
  10.      string Syl;
  11.      int P = Line.length()-1;
  12.      while (Line[P]!='a'&&Line[P]!='e'&&Line[P]!='o'&&Line[P]!='u'&&Line[P]!='i'&&Line[P]!=' '&&P!=0){
  13.         Syl += Line[P];
  14.         P--;
  15.      }
  16.      Syl = Syl + Line[P];
  17.         P--;
  18.     //cout<<Syl<<endl;
  19.      return Syl;
  20. }
  21.  
  22. int main() {
  23.     int verses;
  24.     cin >> verses;
  25.     cin.ignore();
  26.    
  27.     for(int i=0;i<verses;i++){
  28.     string L1;
  29.     getline(cin,L1);
  30.         L1 =getSyl(L1);
  31.     string L2;
  32.     getline(cin,L2);
  33.         L2 = getSyl(L2);
  34.     string L3;
  35.     getline(cin,L3);
  36.         L3 = getSyl(L3);
  37.     string L4;
  38.     getline(cin,L4);
  39.         L4 = getSyl(L4);
  40.        
  41.     if(L1==L2&&L3==L4&&L1==L3&&L2==L4&&L1==L4&&L2==L3){
  42.         cout<<"perfect"<<endl;
  43.     }else if(L1==L2&&L3==L4&&L1!=L3&&L2!=L4&&L1!=L4&&L2!=L3){
  44.         cout<<"even"<<endl;
  45.     }else if(L1!=L2&&L3!=L4&&L1==L3&&L2==L4&&L1!=L4&&L2!=L3){
  46.         cout<<"cross"<<endl;
  47.     }else if(L1!=L2&&L3!=L4&&L1!=L3&&L2!=L4&&L1==L4&&L2==L3){
  48.         cout<<"shell"<<endl;
  49.     }else{
  50.         cout<<"free"<<endl;
  51.     }
  52.    
  53.     }
  54.     return 0;
  55. }
Add Comment
Please, Sign In to add comment