0 喜歡 0 不喜歡
1.8k 瀏覽
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
[練習] Coding (C) - 最新提問 分類:Midterm |
ID: 24268 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.8k 瀏覽

13 個回答

0 喜歡 0 不喜歡
內容已隱藏
#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;
*** * * * * ** *** i<MAX_CHARS; i++)

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



    }
*** * *** ** *** ** * ** * * *** *** * * frequency[max]);
* ** ** * * ** ******* * ** 0;

}
最新回答 用戶: (-48 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#define MAX_SIZE 100

#define MAX_CHARS 255



int main(){
** * ** * * ** ** ** string[MAX_SIZE];
** * * ***** ** * ** * times[MAX_CHARS];
* * ** ** ****** ** ** * i = 0, max;
* * * ** * *** count;


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


** *** * **** ** * ** ** *** * i<MAX_CHARS; i++){
*** * ** **** * ** *** * *** ** * ** * * ** ** ** = 0;
** * ** ** ** *
* * * *** ** * *


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


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


** * * *** * ** * **** i<MAX_CHARS; i++){
* * ***** ** *** * * * *** ** * **** **** ** * > times[max])
** * * * * * ** * *** * * ** *** * *** ** * *** * * ** * ** ** = i;
* * ****** * * * ***** * ** **
* * ** *** ** * ** * * *** * ** *** * * *


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



}
最新回答 用戶: (20 分)
0 喜歡 0 不喜歡
內容已隱藏
#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;

}
最新回答 用戶: (20 分)
0 喜歡 0 不喜歡
內容已隱藏
#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;
* ** * * * * **** * * *** * i<MAX_CHARS; i++)
* *** **** * * ** * ** **
*** ** * *** * *** ** ** * ** *** * ** * *** * * * ** * * * **** *
** * ** ***** * ** * ** * * *** * * * * **** * ** **** *



    }
* * * ** ***** * * *** * *** ** ** * * ** frequency[max]);
* * ** * ***** ** ** 0;

}
最新回答 用戶: (-48 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#define MAX_SIZE 100

#define MAX_CHAR 255





int main()

{
** * * ** * * * * * * *** string[MAX_SIZE];
* ** ** * * * * ** frequency[MAX_CHAR]; int i = 0, Max; int ascii;


* *** * * ***** * * ** *
** * * ** * ** ** * *** ** * i<MAX_CHAR; i++)
** *** * **** *** ** * **
**** * * * ** * * * *** * ****** * * ** *** *** * = 0;
* * ** *** * **


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


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






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


*** ** * * ** ** **** ** * *** * i<MAX_CHAR; i++)


***** * * ** * *
* * * * **** * * ** *** ** ** * * * * ** > frequency[Max])


*** * * ** ** * **** *** **** **** ** ***** * * *** * * * ***** *** * * = i;
* *** * *** ** ** * ** *




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


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

}
最新回答 用戶: (44 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#define MAX_SIZE 100

#define MAX_CHARS 255

int main()

{
* ** * * * * * * **** string[MAX_SIZE];
** *** **** ******** * freq[MAX_CHARS];
* *** ** ***** * ** i = 0, max;
* *** ***** *** * * ascii;
* ** *** **** * * * * ** **
*** ** ** ** * * * * * i<MAX_CHARS; i++)
* * ** * * * *** * ***
* * * * ** * ** ** ***** *** ** ***** ******* = 0;}
** ** **** ** ** ** **
** * * ** * *** * * * * ** * * * !='\0')
* * ** * *** * * *
* ***** * ****** * ** * * * * * * * * * **** ** ** = (int)string[i];
* *** ** * * * * * * * * ** **** * ** *** * += 1;
* * ** * *** * * *** * * * *************
* * * * * **** **** = 0;
* * * * ** * ***** * * * *** * i<MAX_CHARS; i++)
* ** * ** ***** * *
** *** ** * * *** ** **** * * * * ** **** > freq[max])
* * *** * ** * * ******** * ** * ****** **** * *** **** * * ** ** *** * ** = i;}
** ** ** * * * * ** *** ** * * ** * * * * *
**** ** ** ** **** *** * 0;
*** * * * * * *
最新回答 用戶: (38 分)
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

#define MAX_SIZE 100

#define MAX_CHARS 255

int main()

{
******** *** ** **** ** string[MAX_SIZE];
** * * * *** *** ** * ** freq[MAX_CHARS];
* * **** * * ** * i = 0, max;
* **** * **** * ***** ** * ascii;
**** *** **** ** *** ** *** *
* * **** * * ****** ** * ** * i<MAX_CHARS; i++)
*** * ** * *****
**** ** ** ** * *** *** ** *** * ** *** ** * ** * = 0;}
* ** ****** *** * * *
****** * * ** ** *** *** * *** * != '\0')
* *** * * ** *** ** * *
* * ** * * * ** * ** * * * ** * **** * = (int)string[i];
* * * ** ** * * * * * * * ** * *** += 1;
* *** ** ** ******* * *** * ** ******* * * * ** *
* ** ** * *** * ** = 0;
* * ****** * ***** ** ** * i<MAX_CHARS; i++)
**** * * * * * * * ****
** ** * ***** * ** * *** **** ** ** *** ** * **** * > freq[max])
**** * * ** * * ** * * *** * * * * **** * ** *** ** * * ***** = i;}
* ** * * ** ** * ** ** ** * ** ****
** * ** * ** * * * * 0;
最新回答 用戶: (38 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * ** ** ****

#define MAX_SIZE 100 //Maximum size of the string

#define MAX_CHARS 255 //Maximum characters allowed



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;
* * * * *** *** ** *
*** ** **** *** * * * * * ** ** ** ***
* * ** * * * ***** * 0;

}
最新回答 用戶: (38 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * * * ** * ** *

#include *

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

int main(){
** * * *** * *** *** * i, j;
* * ** ** * **** * word[100];
** * ** * ** * * * * lenght = 0;
* *** * ** * ** * * * * ** max = 0;
* * ** ** ** *** *** counter[26] = {0};
**** ***** *** ** ** * Alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};


** * * **** ** *** * * * * word);
* *** *** *** *** ** * * * * = strlen(word);
**** *** *** * * ** * ** * ***** * *** ** ** lenght);
** ** **** *** * ** *** * * *** i++){
* ** * * * ** ***** * * ****** ** * *** * j<26; j++){
** * *** * ** ** * ** * * * * ** ***** ***** ** * * ** * *** * ** * * == Alpha[j]){
* * * ** * **** * **** * ** ** ** * * ** ****** ** ** * * * ***** * ** ****** * * *
* *** ** * * *** * * **** * * * * * *** * *** * *** * **** ** * *
* ** *** * * * *** ********** * ** *
* *** ** ** * * * * *


* * * * ** * * ** **** ** ** i<26; i++){
** ** ************ * ** **** * * ** ** > max)
* ** * ** * * * * **** * * * * * * * ********** ** ** * *** ***** ** * * = counter[i];
* *** ** *** ** * **** *


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


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

}
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
* *** **** ***** * *
*** * * * * * ** *
* ** * *** *


* * *


* * * *
* num ** = *
i;
** max =0;


*** *




( ** * * ** * *
* ** *


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

if * * ** num *
*** * ** * * *** ** **

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


** 0;}
最新回答 用戶: (-34 分)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.80.233
©2016-2025

相關問題

0 喜歡 0 不喜歡
11 回答
[考試] 最新提問 4月 21, 2017 分類:Midterm |
ID: 24270 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.8k 瀏覽
0 喜歡 0 不喜歡
47 回答
[考試] 最新提問 4月 13, 2017 分類:Midterm |
ID: 23784 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 5.2k 瀏覽
0 喜歡 0 不喜歡
8 回答
[考試] 最新提問 4月 21, 2017 分類:Midterm |
ID: 24273 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.3k 瀏覽
0 喜歡 0 不喜歡
4 回答
[考試] 最新提問 4月 21, 2017 分類:Midterm |
ID: 24272 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 944 瀏覽
0 喜歡 0 不喜歡
6 回答
[正常] 最新提問 4月 21, 2017 分類:Midterm | 用戶: thopd (12.1k 分)
ID: 24271 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.1k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶