0 like 0 dislike
1.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 Midterm
ID: 24268 - Available when: Unlimited - Due to: Unlimited
| 1.2k views

13 Answers

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

#include <string.h>

#define MAX_STR 50



int main(void){

    int c1=1, c2=0, i;

    char a[MAX_STR];


* ** ** * **** * * * ** *** ****** * a);
*** ** ********** * * * * *** ** i<strlen(a); i++){
* ** **** * ** * ** *** * *** **** ** * *
* * *** * *** ****** * **** ** * *** ** ** **** * ** * ** ** *** *
*** *** *** * * * ** **** ** * * **** **
* **** * * * *** ***** * **** * * *** * ******* * *** * * ****
* * ** * ** ** ****** * * ** ** ** ** * * * * * * ******** * *** ** *** ** *** *
* ** * *** * * ** * * ** * ** ** *** * * * *** * * * * ** ** ** * * ****** *** * * *
* * * *** ****** * ** **** * ** **** * ** ****

    }
* * * ** ** ** * ** * *
********* * ** ** * * * ** *** * * *** **** * ** **** **** ** c2);
** * ** * ******
* * *** ** *** * * **** * * ** * ***** * * * * * ***** * *** ** c1);


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

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

#include <string.h>

#define MAX_STR 50



int main(void){

    int c1=1, c2=0, i;

    char a[MAX_STR];


* *** * * ** * ** * **** ** * ******* a);
* ***** * ** ***** * * * *** i<strlen(a)+1; i++){
** * * * * * *** * * ** * ****** * ** * * * * * * **
****** ***** ** *** *** **** * * *** * * ** * * ** * *** * * * * * * * *
* * * * * *** *** * * ** * ** * * ***
* * *** * * ** * * ** *** * ** * * *** *** * ** * * ** * * **** *
* *** ** * * *** * * * ** * * * ** ** **** * * ** *** * *** ** ** ***** * ** ** * ** **
** ** ** ** ** * * ** * ** * * * * * *** * *** *** ** * * * *** **** *** ** * ** * **
* ** ** * ** ** ** * *** **** ** **** *

    }
** *** * * * *** ** * **** **
** * * *** ** * * * * * ******* * *** ** * *** ** * ** * ** * c2);
* ***** ** *** ***** *
* ** * **** * ** * * ***** **** * * ******** ** * * * c1);




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

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

#define MAX_STR 50



int main(void){

    int c1=1, c2=0, i;
**** ** **** ***** * * * ** ** a[MAX_STR];


* ** ***** * * * ** *** ** ** * ***** * * a);
* ** * ** * **** * ** i<strlen(a)+1; i++){
*** ***** ** ** * * * * *** * *** ** ***** * ** * * *
* **** ******** * ** ** * * ** * * * ** ** **** * * * * * *** *
*** *** ** **** * * * ** * * * **** ***
** ***** * * * *** ** * ** ** * * ** * *** *** **** **** *** * * **** * **
******* ** * * *** * **** * * * * **** ***** * * *** *** * **** * * * ** ****** * ***
*** * ** ** ** ** *** * * * * * *** ** * **** ** ** * **** *** * ** ** *****
* * * * *** * * * * * * *** * ******* *** *** **

    }
* ****** * **** *** * **
* * *** **** ***** * ** * ** *** *** ** ** * * * * c2);

    else
* **** * * ***** * **** * ** ** * * * ** * * *** * c1);




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

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

Related questions

0 like 0 dislike
11 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24270 - Available when: Unlimited - Due to: Unlimited
| 1.1k views
0 like 0 dislike
47 answers
[Exam] asked Apr 13, 2017 in Midterm
ID: 23784 - Available when: Unlimited - Due to: Unlimited
| 3.5k views
0 like 0 dislike
8 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24273 - Available when: Unlimited - Due to: Unlimited
| 846 views
0 like 0 dislike
4 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24272 - Available when: Unlimited - Due to: Unlimited
| 601 views
0 like 0 dislike
6 answers
[Normal] asked Apr 21, 2017 in Midterm by thopd (12.1k points)
ID: 24271 - Available when: Unlimited - Due to: Unlimited
| 722 views
12,783 questions
183,442 answers
172,219 comments
4,824 users