Advertisement
Guest User

7.3

a guest
Nov 22nd, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. // uloha-7-3.c -- Tyzden 7 - Uloha 3
  2. // Katarina Rafcikova, 6.11.2014 17:38:01
  3.  
  4. #include <stdio.h>
  5. #define MAX 50
  6.  
  7. int main()
  8. {
  9.     char pole[MAX], c, x, y, z;
  10.     int i = 0, j = 0, velkost = 0;
  11.  
  12.     while ((c = getchar()) != '\n') {
  13.         if (i < MAX) {
  14.             pole[i] = c;
  15.             i++;
  16.             velkost = i;
  17.         }
  18.     }
  19.     x = getchar();
  20.     y = getchar();
  21.     z = getchar();
  22.  
  23.     for (i = 0; i < velkost; i++) {
  24.         if ((pole[i] == x) && (pole[i + 1] == y) && (pole[i + 2] == z)) {
  25.             for (j = i; j < velkost; j++) {
  26.                 pole[j] = pole[j + 3];
  27.                 i = 0;
  28.             }
  29.             velkost -= 3;
  30.         }
  31.     }
  32.     for (i = 0; i < velkost; i++) {
  33.         printf("%c", pole[i]);
  34.     }
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement