Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include <cctype>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. char s[256], voc[256]="aeiouAEIOU", aux[255], aux1[255];
  10. unsigned int i, j, g1, g2;
  11. g1=g2=0;
  12. cin.get (s, 256);
  13. cin.get();
  14. for (i=0; i<strlen(s); i++)
  15. if (strchr(voc, s[i]))
  16. g1=1;
  17. else g2=1;
  18. if (g1==1&&g2==1)
  19. {
  20. for (j=strlen (s)-1; j>=0; j--)
  21. if (!strchr(voc, s[j]))
  22. {
  23. strcpy (aux1, s+j);
  24. break;
  25. }
  26. for (i=0; i<strlen(s); i++)
  27. if (strchr(voc, s[i]))
  28. {
  29. strcpy (aux, s+i);
  30. break;
  31. }
  32. strcpy(s+i, aux1);
  33. strcpy(s+i+1, aux+1);
  34. strncpy(s+j, aux, 1);
  35. cout<<s;
  36. }
  37. else
  38. cout<<"IMPOSIBIL";
  39. return 0;
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement