Advertisement
Guest User

Untitled

a guest
May 24th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5.    
  6.     char string[21];
  7.     scanf("%20s", string);
  8.     int counter = 0;
  9.    
  10.     int i;
  11.     for (i = 0; i < strlen(string); i++) {
  12.        
  13.         if (string[i] == 'a') {
  14.             if (string[i + 1] == 'u') {
  15.                 string[i] = 'e';
  16.                 string[i + 1] = 'i';
  17.                 counter += 2;
  18.                
  19.             } else if (string[i + 1] == 'U') {
  20.                 string[i] = 'e';
  21.                 string[i + 1] = 'I';
  22.                 counter += 2;
  23.             }
  24.         }
  25.        
  26.         if (string[i] == 'A') {
  27.             if (string[i + 1] == 'u') {
  28.                 string[i] = 'E';
  29.                 string[i + 1] = 'i';
  30.                 counter += 2;
  31.                
  32.             } else if (string[i + 1] == 'U') {
  33.                 string[i] = 'E';
  34.                 string[i + 1] = 'I';
  35.                 counter += 2;
  36.             }
  37.         }
  38.     }
  39.    
  40.     printf("neue Zeichenkette: %s\n",string);
  41.     printf("Anzahl geänderte Zeichen: %d\n", counter);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement