Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int vocale(char x){
- if(x=='a' || x=='e' || x=='i' || x=='o' || x=='u') return 1;
- if(x=='A' || x=='E' || x=='I' || x=='O' || x=='U') return 1;
- return 0;
- }
- int main(){
- int i,n,p=-1,u=-1;
- char s[22];
- cin >> s;
- n=strlen(s);
- for(i=0;i<n;i++){
- if(vocale(s[i])==1){p=i; break;}
- }
- for(i=n-1;i>=0;i--){
- if(vocale(s[i])==0){u=i; break;}
- }
- if(p!=-1&&u!=-1){
- char aux=s[p];
- s[p]=s[u];
- s[u]=aux;
- cout << s;}
- else cout << "IMPOSIBIL";
- }
Add Comment
Please, Sign In to add comment