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

52 Answers

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

#include <stdlib.h>

#include <string.h>



int main()

{
** * * * * *** a[1000];
***** *** * * ** * * ** b[26]={0},i,max=0;


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


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


* ** * ****** ** ** * ***** ** i<26; i++)
****** * ***** * **
* * * * * * * *** ** * *** ********** ** * *** ** > max)
** * * ** ***** * *** * * *** **** *
** * ** ** * * ** ** *** ** * * ** **** ***** ** * * **** ** ** = b[i];
* ** *** * *** ***** * ** * * ** * ** **
* ** * * ** * **
** * ** ** * * *** * **** * **
*** ** **** * ** ** * * * 0;

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

#define MAX_SIZE 100

#define MAX_CHARS 255

int main()

{
** **** * ** *** *** * * ** string[MAX_SIZE];
**** ****** * * *** *** frequency[MAX_CHARS];
** ** * * * ** * * * ** i = 0, max;
*** * * ** ** * * * *** ascii;
** **** * *** ** * * *** * ***


*** *** * ** **** * **** ** * * i<MAX_CHARS; i++)
* * ** ** *** *
** ***** ** * * * * *** * ****** * ** * * *** * ** * = 0;
** ** * *** ***** *
** * *** **** * ** * ** *
********* * * * ** * ** * != '\0')
* * * ** * ** ** * ** *
**** ** * *** * * * ** * *** * * * * *** *** * ** * = (int)string[i];
*** * * * **** * * ** *** * * * * * * ** ** += 1;
* * ** ** ** * * * * ***** * * ** *** **
* * ** * *** * * * *
*** * * ** * * ***** = 0;
** ** * * * ** ** * i<MAX_CHARS; i++)
** * * * *** * *** ****
* ** *** * ** * ***** * *** ****** * *** * ** * * > frequency[max])
** * * **** ****** * ***** * * *** *** * ****** ** * * * ** * * = i;
*** **** * * ***
* *** * ****** * * * * * ** * **** * * frequency[max]);
** * * ** * *** *** 0;

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

#include<string.h>



int main(void)

{

    char word[100];

    int n[26];
** * ** * ** *** ** * * * *** **

    {
*** * *** * ** * ** * *** *** ** l,i,large;
*** * *** **** * * * * *** **** ***** * * *** * **
* * * * * * ** * ** * * ** * ** * ** data;
* ** ** *** * * * * * **** * * * ** ** * * * **
* *** * **** ** ** **** ** ** * * ***** **
* **** * ** * * * ** ***** ** ** **** ** * * * * * ********
* * ** *** * *** ** * * ** *** * ** *** **
* *** * ** ** * **** * *** * * **** *** * * * ** * * *** **** *
**** ***** * ** *** ***** *** * *** **** * * * *** * * * ** * * * **
** * *** **** * *** ** * * ** ** ***** * *
*** ***** ** *** * ** ** * ** ** * *** ** * *
* * **** ** * * * ** ******* * * *** *
*** ** ** **** ***** * * * ** * * * * ** ***** * ****** * ** *** * * * * *
* ** ** ** * ******* * * ** * * ****** ** ******** * ** ***** * * * ** *** * * * *** **** *
* ** * * * * * ** * ** * * ** ** *
** * ** ** **** * * * * **** * * ** * *** * ***** * * * **** * ** ***



    }

    return 0;

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

#include<stdlib.h>

#include <string.h>

int main()

{

    char a[1000],b[1000];

    int i,j;

    int count=0,stop=0,c=0,max=0;
* ********** * * * * * ** **** ** **
* * ****** * * *** * *

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

    {
* *** * * **** * * * ** ** ** * ** * * * * **** ****** **
** * * * ** * **** *** *** ** **
* *** * ** * * ** *** **** * ** ** * * ***** * ** * * *** *** ** ** **
* * ***** * ** * **** * * * *** ** * * * * * * ***** **** * *
* **** ***** * * * ** ** **** * * * * * *** * ** * ***** * * * * * *** **** *** *
* ** * * * ** * * * ** * ** * * * * ** ** *** ****** * ***** * ** ****** ** ***** ** * *** ",count);
* * *** ** ** * * ** **** * * * ** *** ** * ** ***
** *** * * * * *** * ** **** ** * *
**** **** * * * ***** ** * ** **** ** ** * * ******* ** *
** * * * ** ** ** ** ** **** *** * * ** * *** *
******** * *** ** ****** * ** * * **** *** ** ** * * ***
* * * * * ** * * **** * ** ** *
** * *** * ** * *** * ** *** * ** * *

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

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

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

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

#define MAX_SIZE 100

#define MAX_CHARS 255

int main()

{
***** *** **** string[MAX_SIZE];
* ** ** * ** * ** *** * *** frequency[MAX_CHARS];

** **** *** * * * ***** i = 0, max;
** * * *** * ** * * * **** ascii;
* **** * * ** * * ** * * * * any string: ");
* ** * ***** *****


**** **** * * ** ** * i<MAX_CHARS; i++)
* *** * * * * * * *
* * * * * *** *** * ******** * ** * * ** * * * = 0;
** * *** *** * ****
* * ***** ** ** ** *
**** * * *** *** ** ***** ** *** != '\0')
** * * * *****
*** ** * * * * * * * * **** ****** ** * * * * = (int)string[i];
* * *** **** * * ** ****** ****** ** ** * * * * ** += 1;
* ***** *** ** * ** * ** ** *** * * ********* ***
*** * * * ** * **


**** ** * * ** ** *** * **** = 0;
** * * ** ** ** * * * * *** i<MAX_CHARS; i++)
** * ******* * **** * * ** *
* ****** ** * ** ***** * * * ** *** * * * * * ** ** ** ** > frequency[max])
* ** ***** **** * * * *** *** *** * *** * * *** * ** ** * = i;
*** * * ** ** * ** *** *


** * * ***** ** * ** ** ** ***** ** * frequency[max]);


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

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

#include <string.h>

void main ()

{
* * * ** * **** * *** ** * a[130]={0},b,i,j,max=0;
**** * * ** * * ** word[100];
* ** * * *** ***** * * *** **
** ***** * ** ** * * * * *


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

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

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

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

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

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

#include<string.h>



int main()

{
*** *** * * *** ** len,i,max=0;
* ****** ** *** * ** * * a[99]={0};
** ** ** * * * ** b[26]={0};
* *** *** ** * ** ****
* ** ** * *** ** * * **** ***** ** **
* *** * * ** * ** ** i<len; i++)

    {
** * * ********* ** * * ** **** * *** * *
* * * * ** * * **
* ** * * **** *** * ** ** ** i<26; i++)
* * * ** * *** * *
** * ** **** *** **** * * * * ***** * ** ** ** **
* * * *** ** * * **** * * ** ***** *****
** *** * ** ** * * *** * * * ****** ****** * * * * * * * * **
** * *** * * * ***** ** * ***** *** * * ****
* ******** **** *** * ** *
* * * * *** ******* * * ** * ** **** *** **

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

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



int main()

{
* *** * * ** ** a[100];
* * * ** *** * ** *** *** i, b[26]={0}, c;
**** * * ******** * **
** * * ** * ** *** ** * i<strlen(a); i++)
* *** * * * * * * *** **
* * * * * *** * ** * * * ** * * ** ** * ***
** ** ** * * * ** * *
* * * * * ** * * * * = b[0];
* * * ******* * ** * *** i<26; i++)
** **** * * *** ***** * ** ***** ** **** * * * ** * * * c = b[i];


* ** ** *** * ****** * * * * ** * * c);


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

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



int main(void){

    int letter[26]={0}, i, max_value=0;

    char input;
** ** ** * * * ** **** *
** * * * **** * * ** * ** * ** ** ** * ** ** *
* ** * * * * ** ** * ***** **** * break;
*** * *** ** * * ** *** ** ** *** * * **
* * ** *** *** **** * * ** * * * * ** ** **
* * ** ***** ** *** * * * * *** * * ** ** ** * *** ** ******* * ** ** * *
** **** * ** ** *** * * * * ** * **** * * *** * ****** **** **** ** * * *** * * * *
*********** * * *** ** * ***** ** *** ** ****** * ** * * * * *** **** * *** ** * * * *****
******* * ** * ** ***** * *** * ** * *** * ** * * **** ** ****** **
* ***** **** * ** ****** ** * **** ** ** * * * ** * *** * ** ** ***** * i++;
* ** **** **** ** * *** * *** *** * **** * *** ** * ** ** ** * break;
***** * ** * ** ** **** * ** * * * *

    }


* ** *** * * * ** * i<26; i++){
* * ** *** * ***** * ** ** ** * * * ***** *** * * * *** * * max_value=letter[i];

    }


* **** *** * ** * *** ** * *** * ** * * * ** max_value);


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

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



int main()

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

}
answered by (-218 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

1 like 0 dislike
58 answers
[Exercise] Coding (C) - asked Mar 23, 2017 in C
ID: 23261 - Available when: Unlimited - Due to: Unlimited
| 9k 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
| 4.5k 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
| 10.2k views
12,783 questions
183,442 answers
172,219 comments
4,824 users