Advertisement
Guest User

Untitled

a guest
May 26th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool check(char a) {
  5. if (a == 'a' || a == 'i' || a == 'u' || a == 'e' || a == 'o' || a == 'A' || a == 'I' || a == 'U' || a == 'E' || a == 'O') return true;
  6. else return false;
  7. }
  8.  
  9. int main() {
  10. int n;
  11. scanf("%d", &n);
  12.  
  13. char a[n][105];
  14.  
  15. for (int i = 0 ; i < n ; i++) {
  16. scanf("%s", a[i]);
  17.  
  18. for (int k = 1 ; k < strlen(a[i]) ; k++) {
  19. if (check(a[i][k]) && check(a[i][k-1])) {
  20. a[i][k] = toupper(a[i][k]);
  21. a[i][k-1] = toupper(a[i][k-1]);
  22. }
  23. else if (!check(a[i][k]) && a[i][k-1] == 'g' && a[i][k-2] == 'n') {
  24. a[i][k] = toupper(a[i][k]);
  25. a[i][k-1] = toupper(a[i][k-1]);
  26. a[i][k-2] = toupper(a[i][k-2]);
  27. }
  28. else if (!check(a[i][k]) && !check(a[i][k-1])) {
  29. if (a[i][k] == 'g' && a[i][k-1] == 'n') continue;
  30. else {
  31. a[i][k] = toupper(a[i][k]);
  32. a[i][k-1] = toupper(a[i][k-1]);
  33. }
  34. }
  35. }
  36. }
  37.  
  38. for (int i = 0 ; i < n ; i++) printf("Case #%d : %s\n", i+1, a[i]);
  39.  
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement