Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main (int N)
  5. {
  6.   int c;
  7.   N = 3;
  8.   int i = 0;
  9.   int MAX;
  10.  
  11.   char *pole = malloc(100*sizeof(char));
  12.   if(pole == NULL)
  13.     return 0;
  14.  
  15.   while((c=getchar()) != EOF)  {
  16.     pole[i] = (char)c;
  17.     i++;
  18.   }
  19.  
  20.   MAX = i;
  21.   i = 0;
  22.  
  23.   for(int k = 0; k < 3; k++)
  24.   {
  25.  
  26.     if((i + N) < MAX && pole[i] == pole[i+N])
  27.       {
  28.       putchar(pole[i]);
  29.       i++;
  30.       }
  31.   }
  32.  
  33.  
  34.   free(pole);
  35.   return 1;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement