Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
84
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. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     int cnt = 0;
  8.     char c1, c2, c3, c4;
  9.     scanf(" %c %c", &c1, &c2);
  10.     while(scanf(" %c %c", &c3, &c4) != EOF)
  11.     {
  12.         if((c1 == c3 && c2 == c4) || (c1 != c3 && c2 != c4))
  13.             cnt++;
  14.         else if((c1 == c3 && c2 != c4) || (c1 != c3 && c2 == c4))
  15.         {
  16.             c1 = c3;
  17.             c2 = c4;
  18.         }
  19.     }
  20.     printf("%d\n", cnt);
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement