0 like 0 dislike
2.7k 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
| 2.7k 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:104.23.197.64
©2016-2026

Related questions

0 like 0 dislike
11 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24270 - Available when: Unlimited - Due to: Unlimited
| 2.7k views
0 like 0 dislike
47 answers
[Exam] asked Apr 13, 2017 in Midterm
ID: 23784 - Available when: Unlimited - Due to: Unlimited
| 7.3k views
0 like 0 dislike
8 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24273 - Available when: Unlimited - Due to: Unlimited
| 1.8k views
0 like 0 dislike
4 answers
[Exam] asked Apr 21, 2017 in Midterm
ID: 24272 - Available when: Unlimited - Due to: Unlimited
| 1.4k 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
| 1.6k views
12,783 questions
183,442 answers
172,219 comments
4,824 users