dumitreskw

84

Nov 1st, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. int vocale(char x){
  5. if(x=='a' || x=='e' || x=='i' || x=='o' || x=='u') return 1;
  6. if(x=='A' || x=='E' || x=='I' || x=='O' || x=='U') return 1;
  7. return 0;
  8. }
  9. int main(){
  10. int i,n,p=-1,u=-1;
  11. char s[22];
  12. cin >> s;
  13. n=strlen(s);
  14. for(i=0;i<n;i++){
  15. if(vocale(s[i])==1){p=i; break;}
  16. }
  17. for(i=n-1;i>=0;i--){
  18. if(vocale(s[i])==0){u=i; break;}
  19. }
  20. if(p!=-1&&u!=-1){
  21. char aux=s[p];
  22. s[p]=s[u];
  23. s[u]=aux;
  24. cout << s;}
  25. else cout << "IMPOSIBIL";
  26.  
  27.  
  28. }
Add Comment
Please, Sign In to add comment