Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {char s[21];
  7. int i,x=0,y=0,n,doarvoc=1,doarcons=1;
  8. cin>>s;
  9. n=strlen(s)-1;
  10.  
  11. for(i=n;i>=0;i--)if(tolower(s[i])!='a' and tolower(s[i])!='e' and tolower(s[i])!='i' and tolower(s[i])!='o' and tolower(s[i])!='u'){x=i;doarvoc=0;break;}
  12. for(i=0;i<=n;i++)if(tolower(s[i])=='a' or tolower(s[i])=='e' or tolower(s[i])=='i' or tolower(s[i])=='o' or tolower(s[i])=='u'){y=i;doarcons=0;break;}
  13. if(doarcons==1 or doarvoc==1){cout<<"IMPOSIBIL";return 0;}
  14. for(i=0;s[i];i++)if(i==y)cout<<s[x];
  15. else if(i==x)cout<<s[y];
  16. else cout<<s[i];
  17.  
  18. return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement