0 like 0 dislike
6.3k views
Write a program to count the highest occurrence of a single character in a string, Hint: This problem is only concerned with lowercase letters and single words, no sentences

example

input: aaaaaaaaaabb
output : 10

input: aaaabbbccccceeeezzzzzzz
output : 7
[Exercise] Coding (C) - asked in C
ID: 22017 - Available when: Unlimited - Due to: Unlimited
| 6.3k views

52 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>



int main()

{

int a,b,c,i,j ;

int arr[100]={0}, count[27]={0};



for(i=0;i<100;i++)
*** * * ** *** ** *
**** * * * * * ** * = getchar();
** *** ******** ** * * ****
* * ** * ** *** *** ***


** ** *** ** * **** **





for(i=0;i<26;i++)
* *** * * *** **** * ** ** ***
*** *** *** * ** ** * * **
**** **** * ** * * ** ** * * * **** ***** *
* ***** ***** * ** * * * *** * * * ** * * ** * ******* * ** * * *
** *** * ** ** * *** **** *** * ** ** * *** ***** * * ** * *** ** * * **** *** * * * *** *
** * ** **** ** **** ** **** **
* ** * * *** *** ***

a = 0 ;

for(i=0;i<26;i++)
*** ** * *** ** ** * *
* **** ** * * ** * * * *** *** ** ** * * ** * ****** *****
* * ** ***** **** * * * * * * *** * ** ** * * * *** ***** * ** ** = count[i];


*** * ** ** ****** * * ** * ***** * * * ***** * * * * *** * * ***** *
* ** * ** ***** *

printf("%d",a);





}
answered by (-368 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<ctype.h>

#include<string.h>

int main()

{
* ***** * * ** ** * * * * A[1000], alpha = 'a';
* ** * * * * ** * * check[26];
** **** ***** * ** * count[100]={0};
*** ****** * *** *** * i=0, j=0, max=-1, remember;


** ** ** ** ** ** *** *


* *** *** *** * * *** * **

    {
* * * * * * * *** * ** *** *** ** * = alpha;
* * *** ***** * *** * ** * * **** * * *** * ****

    }


** ** **** ** * * *** *** ** * i<strlen(A); i++)

    {
* *** * * *** * * * * ** * * ** ** * * * * *** *** * ***
******** * * ****** * *** * ******* ** ** * *
*** * * **** * **** * ** * * ** ** * ******** * * ** * * ******* ** (A[i]==check[j])
** ** ***** * * * * ** ** ***** * ** * ** * **** **** ** ** ** *
* * ****** **** ** **** * * * * ** * ** * * ** *** * * **** * ** *** * **** * *
* * * * *** *** * ***** * * * ** ** * * *** * ******** ** * ** *
* * ** * * * ** * * * ***** ** * ** **
* * ****** * * **


** * * * * **** * * * * * * i<strlen(A); i++)
* * * * * * * * * ** **
* *** * * *** * ** ** ** ** ** * * * * ** *** ** (count[i]>max)
***** ****** **** ** ***** *** * * * * *
** ** * ** * ***** **** * * * ** * ** *** ** * **** ** * ** * * * = count[i];
*** * ** ** *** * *** ** *** * **** * ** ***** * *** ** * * * * = i;
* * * * ** ** ** * * *** *** *** *** *
*** * * * *** * * ** **
**** * *** * * * ** **** * * * count[remember]);


* * ** ** ******* * 0;

}
answered by (-368 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>



int main()

{

int a,b,c,i,j ;

int arr[100]={0}, count[27]={0};



for(i=0;i<100;i++)
* ** * * * * ** *
** ** *** * ** = getchar();
** * * * * ** * ****
*** * * * * **** ***


**** * * *** * * *





for(i=0;i<26;i++)
* * ** *** ** ******
* **** * *** ** * * ** ** *****
* ** ***** * ** * ** *** *** *** * ** ** *
* ** * * * *** * *** * ** * ** *** * * * * ** * * * ** * *
* * * ** * * ** * * ** ** **** * *** * * ******** * * ** ** ** * *** *** * **** *
******* * * **** * ** *** * ** * * ** * *
* *** * ** ***** ******** *

a = count[0];

for(i=0;i<26;i++)
*** ** ** ** ** ** *

  
** * ******* ** * * ** * ***** ****** **
* *** *** * * * * * * * ** **** * = count[i+1];
* **** ** * * * *** *
** ** * * ** ***





}
answered by (-368 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<string.h>



int main(void)

{

    char a[1000];

    

    scanf("%s",&a);


** ** * *** * * * * **** * ** **** * * * i;
* * * ** * * * ** * * ** ** * * ** ** *** ** b[26]={0};
* * ** * * * * * *** *** * * ** * * * * **** *** j,k=0;


* ** ** ****** * *** * **** * ** * * * * **** ** * * * *****

        {
* * ** * **** * ** * *** * * ** ** ** ** * ****** *** * * * * **** * *
* * ***** * * * ** ***** * *** ** **** ** * * **** * * *** * *** * * ** * *
*** ** ** ***** ******* ***** **** *** ** * **** * *
* ** *** *** ** * * * ** * * * * * *********** *** * * ****** **** ** * * * *** * * * **** *
* ** ** * **** ** ***** ** * * * * * * **** ** * * ** ****** *** ** *** * *** * * ** ** * **** ** * ***
* ** * ** ** *** *** ** *** * * ** * **** * ********* ** * ** ** * ******* **** * ** * ** * * ** **** *
* *** ******** * ** ** ** ** * * * * *** ** ***** ** *** **
* * ** * ** * ** ***** * * ** **** * ***


* * * *** * * ** ***** * * ** *** *** * * max=0;
*** ** * **** * * * * ** * ** ** *** ** *** ** **** **

        {
** * * ** ** *** * * * * ** * * **** * **** ** ** ** * ** ***** **** ** *
** * * ** **** ** * **** ** * * * *** * * ** **** ** *****
* * * *** ****** *** * **** *** * ***** ** * * * * * * * * ** * ** * ** * * * * ** *
* ** * * ***** ** ** * ** ** ***** * *** * * * * *** ** ****** * *

        }
* *** * ** ** * * ** *** **** * ** ******* ** ** *** * *







}
answered by (-412 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>

#include<string.h>





int main(){
** * ** * *** ** *** input[100];
** ** * ** ***** * * *** * **** ** * ** * ***
* *** * ***** ********* len = strlen(input);
* * * * * ** *** * **** b[50]; int i;
** ***** *** **** * ** * *
** * **** ** ** **** * ** *** * ** *** * = 0;

    }
* ** * ** ****** * **** a=0;
* ** ** * *** ** ** temp;
** * ** *** ***** ** * (i=0;i<len;i++){
* * * * *** * ******** * ** ** * ** * * ** ** = input[a]-97;
* * * ***** * * ** ** **** * * **** * * * ****
* *** ** *** **** * *** ***** ** * *** **** *
* * * * ** ** * ***
* * * * * * * **** ** * * ** temp2 = b[0];
* *** * * ********* ** * g=0;
* **** * * ** *** * * * ****
** * * **** ***** **** *** * *********** * ** * ******* ****
*** **** ** * ** * * *** *** * * * * * * * ** * * * * = b[i];
* * * **** * ** ** ***** * **** *

    } *** * *** *** * * ** * * * **
** * *** ***** ** ** * * *** ** *
* * * *** * ** * ** 0;

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
* *** * ****
* * ** ** *** * ** ***



int main(){
* ** * * * char *** **
**** * ** * *** ** ******* * * * ****
** *** int len = * ***
**** * * int b[50]; int i;
* ** * ** * * * ** ***
* * * * ** * *** ** * b[i] = 0;
* ** ** ** }
*** ** * int a=0;
* * **** * * int temp;
** ** ** * ** for ** ** *
****** *** * *** ** ** * * temp = ** ***
* * * * * * ** * * * * * *** *
* * ** * ** a++;
* * *** *** }
* * ** * * * int temp2 = b[0];
* *** ***** ** int g=0;
** * ** * * ****** * ***** * *
* ** * * ** * ** **** ** ** **** ** ** ** **** **
* * * *** * * ** ** * * * temp2 = b[i];
** * * * ** ****** * *** ** **** * * }
*** *** * * *   ****** * **

* * *** *** ** *** ** ** ** * *
****   return 0;

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
** **
*** *** * *** *



int main(){
** ** ***** char ** ******
**** ***

* * * ** *** *** *** * *** **** * ** ** *
****** ** int b[50]; int i;
*** ** * * *** ***** **
* * * ***** * * * * *** b[i] = 0;
* *** *** }
* ** *** int a=0;
***** ** * * int temp;
*** **   * * ** * != EOF){
***** *** * * * * * * * temp = * * *
*** ** * * *   *** ** *
** * ** * *** *** ** a++;
* *** *** * }
* *** * * ** int temp2 = b[0];
* * * * * int g=0;
* ** * * * ** * * *** * ****** **
* * * *** * **** * **** * ****** *** *** **** ***
* * * ** ***** ** ** *** *** * temp2 = b[i];
* * * * * * ** **** * * *** ** * * }
* * * **** ** * * * ** ** * *

** * * * * *** * * *** *** **
*** * **** * return 0;

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>



int main(){
***** ** ** * * input[100];

    
** *** * * ** * * ** ******** * ** * *** *
** ** * ******** *** ** b[50]; int i;
* *** **** ** * ** ** ** *
*** ** * * *** * *** ** ** * ** ** ** * ** ** = 0;

    }
***** *** ** * * * * a=0;
*** ** * ** * * ******* ** * temp;
** *** * * ** *** * ** != EOF){
** * * **** ** * * * *** * ***** * * * = input[a]-97;
***** *** * ** ** * * * * * ****** * * *
* *** ** *** *** ** * * * * ** ****** **

    }
* * * * ** * * ****** temp2 = b[0];
*** **** *** * * * * * * g=0;
*** * ******** *** ** ****** * * *
* * * * * ** *** * * * ** *** ** * ** **** *
* * * * ** **** * *** *** ***** **** * ** * * ***** * * * *** * ** * = b[i];
* ** *** * * ** * * * *** * ***** * * ** * ** *** * *
* * * * *** * * **** * * ****** ** * * ** **
* * * **** * *** * *** * ** ****** ** * *
* * * * * * ** * 0;

}
answered by (-134 points)
0 like 0 dislike
Hidden content!
* * ** * * * ***

* * ** **** *

** * * *** ** * **

** * ** ** **



* * *** ** ** *

{



* *** ** *

* * * *** ** ** *

{

*

*** ** * * ** *

* * ** ** ** **

* * ** * * *

{

* **

}

}

* ** **

}

* *

{

* ** *

* ** = * ** ***
**** ( *** *** *****

{

*** *
*

}

*** * * *** *** **



** * * *** ** * *****

* * ** ******* **** *
*** *

}
answered by (-136 points)
0 like 0 dislike
Hidden content!
* * * **
* * ***



int main()

{

int i,max;

char a[1000];

int b[26]={0};

gets(a);
** ** ** ** * *

{
* **** * * **** ******** * ****

}

max=b[0];
* ******* * * ***

{
********* *** *** * * ** * *** ** ** *
* * ***** * * ** * * * *
* ** ** * * **** ** *** * * * ** * ** ******** *
*** ** * ** ***** * *

}
**** ** *** * *

}
answered by (-226 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.189
©2016-2025

Related questions

1 like 0 dislike
58 answers
[Exercise] Coding (C) - asked Mar 23, 2017 in C
ID: 23261 - Available when: Unlimited - Due to: Unlimited
| 7.6k views
0 like 0 dislike
23 answers
[Exercise] Essay (Open question) - asked Mar 23, 2017 in C
ID: 23262 - Available when: Unlimited - Due to: Unlimited
| 4k views
0 like 0 dislike
82 answers
[Exercise] Coding (C) - asked Mar 9, 2017 in C by thopd (12.1k points)
ID: 22674 - Available when: Unlimited - Due to: Unlimited
| 8.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users