0 like 0 dislike
4.2k 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
| 4.2k views

52 Answers

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



int main()

{
* ** *** * ** **** i, count = 0, x = 0aa;
* **** ***** * **** * ** input[1000];
*** ** * ** * * * * * * * ** * * &input);
** *** * * ** *** (i = 0; i < strlen(input); i++)
*** * * * * * ****
* *** ** ** * ********* * *** * ** * * * *** (input[x] == input[i])
** ** * **** ** * **** ** * * * ** *** * * * ** * * * * * ** ** * ** * ++;
**** ** ** * * * * * ** ***** **** *** * * * * **
* * * * * *** *** *** * * * ** ******* ** ** * *** ***
** * * *** ** * * *
* **** * * * ** ** * *** * ** count);
*** ** * **** * * *** * * 0;

}
answered by (-218 points)
0 like 0 dislike
Hidden content!
#include *** * * * **

#include *** ***** * * **

#include * **** ****



int main()

{
* ** ****** * * * ** * * * *** n[1000];
* ** ** * * ******* ****** num[26]={0}, i, max = 0;


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


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


*** **** * ** * **** ** * i<26; i++)
* * **** **** ***
**** * ** * * **** * * * * * * * * < num[i])
** ** **** * ***** * ** * **** * * * *** **** * * * * = num[i];
** *** ******


** * *** * ** *** * ** **** * *** * ** max);


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

}
answered by (5.2k points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.128
©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
| 4.7k 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
| 2.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
| 5.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users