Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstring>
- using namespace std;
- int main()
- {char s[21];
- int i,x=0,y=0,n,doarvoc=1,doarcons=1;
- cin>>s;
- n=strlen(s)-1;
- 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;}
- 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;}
- if(doarcons==1 or doarvoc==1){cout<<"IMPOSIBIL";return 0;}
- for(i=0;s[i];i++)if(i==y)cout<<s[x];
- else if(i==x)cout<<s[y];
- else cout<<s[i];
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement