Assignment 6 Question 2

#include <stdio.h>
#define MAX 100

int main()
{
char str1[MAX];
scanf("%s", &*str1);
int i=0;
int count1=0;
int high=1;
for(i=0;i<MAX;i++)
  {
   if(str1[i]==str1[i+1])
   {
    count1++;
   }else{
    if(count1>high)
    {
   high=count1;
}
    count1=1;
   
   }
   if(str1[i]=='\0')
   {
    break;
   }
  }
 
  printf("%d", high);

return 0;
}

Comments

Popular posts from this blog

Assignment 8 Question 1

Assignment 7 Question 2