Advertisement
apl-mhd

CodeForcesFootbal

Nov 7th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. #include <string.h>
  3.  
  4.  
  5. int distinctLength(char player[100]){
  6.  
  7.  
  8.     int count=0, neighbour=0, i, size ;
  9.  
  10.     size = strlen(player);
  11.  
  12.  
  13.     for(i =0; i<size; i++){
  14.  
  15.  
  16.         if(player[i] == player[i+1]){
  17.  
  18.             count++;
  19.  
  20.             if(count > 5){
  21.  
  22.                 return count;
  23.             }
  24.         }
  25.  
  26.         else{
  27.  
  28.  
  29.             count =0;
  30.         }
  31.  
  32.  
  33.  
  34.     }
  35.  
  36.     return count;
  37.  
  38.  
  39. }
  40.  
  41.  
  42.  
  43. int main(int argc, char *argv[])
  44. {
  45. char player[100];
  46. int playerSize;
  47.     gets(player);
  48.  
  49.     playerSize = distinctLength(player);
  50.  
  51.     if(playerSize > 5){
  52.  
  53.         printf("YES");
  54.  
  55.     }
  56.  
  57.     else{
  58.  
  59.         printf("NO");
  60.  
  61.  
  62.     }
  63.  
  64.    //printf("%d\n", distinctLength(player));
  65.  
  66.  
  67.  
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement