8 喜歡 0 不喜歡
171 瀏覽
請寫一個程式,找出一個句子當中出現頻率最高的單子。

 

輸入說明:

會輸入一個英文句子,以”.”作為結束。

 

輸出說明:

輸出句子當中出現最多次的單字,請將所有字母轉成小寫,如果沒有一個單字是最多的,就在螢幕上輸出none。

 

輸入範例1:

This is a pen.

 

輸出範例1:

none

 

輸入範例2:

Pen pineapple apple pen.

 

輸出範例2:

pen
[考試] 最新提問 分類:2017-1 程式設計(一)AD | 用戶: (18k 分)
ID: 36175 - 從幾時開始: 2017-12-08 18:30 - 到幾時結束: 2017-12-08 21:00
| 171 瀏覽

3 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main()
{
* * *** ** * * ** * *** ** * * ch1();
** * ** **** * **** * * ***
    {
** ***** * * * *** * ** * * * ** * * * * ** * * * ** **** *
** * ***** ** ** *** *** * * * * *** * ** **** ** *** **** * *
* * ** *** * * * * * **** * * *
** * ** ** ** ** * * ** * ** * * *
** ** * **** ** ** * *** * ** *** * * * *** **
* ******* ** ** ** ** * * * * ** ***
* ** * * * ****** * ** * *** * * * ** ** ** * * ** * ** * * **** ** *
******** * * ***** * **** ** ******** **
* **** * *** *** * ** *** * * * * * * * *** *** * ** *****    
* ** * * * **** * * * **** *
* * ** ** ** * ** * ** 0 ;
    
    
    }
最新回答 用戶: (194 分)
修改於 用戶:
0 0
prog.c:2:24: error: expected ';', ',' or ')' before 'str'
 int count(const char[] str, const char key[]);
                        ^~~
prog.c: In function 'main':
prog.c:8:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(str);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:9:11: error: stray '\342' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
           ^
prog.c:9:12: error: stray '\200' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
            ^
prog.c:9:13: error: stray '\234' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
             ^
prog.c:9:14: error: stray '\345' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
              ^
prog.c:9:15: error: stray '\205' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
               ^
prog.c:9:16: error: stray '\261' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                ^
prog.c:9:17: error: stray '\344' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                 ^
prog.c:9:18: error: stray '\275' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                  ^
prog.c:9:19: error: stray '\277' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                   ^
prog.c:9:20: error: stray '\347' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                    ^
prog.c:9:21: error: stray '\224' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                     ^
prog.c:9:22: error: stray '\250' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                      ^
prog.c:9:23: error: stray '\344' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                       ^
prog.c:9:24: error: stray '\272' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                        ^
prog.c:9:25: error: stray '\206' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                         ^
prog.c:9:27: error: expected expression before '%' token
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                           ^
prog.c:9:30: error: stray '\347' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                              ^
prog.c:9:31: error: stray '\250' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                               ^
prog.c:9:32: error: stray '\256' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                ^
prog.c:9:33: error: stray '\350' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                 ^
prog.c:9:34: error: stray '\213' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                  ^
prog.c:9:35: error: stray '\261' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                   ^
prog.c:9:36: error: stray '\346' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                    ^
prog.c:9:37: error: stray '\226' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                     ^
prog.c:9:38: error: stray '\207' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                      ^
prog.c:9:39: error: stray '\345' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                       ^
prog.c:9:40: error: stray '\255' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                        ^
prog.c:9:41: error: stray '\227' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                         ^
prog.c:9:42: error: stray '\346' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                          ^
prog.c:9:43: error: stray '\257' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                           ^
prog.c:9:44: error: stray '\215' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                            ^
prog.c:9:45: error: stray '\342' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                             ^
prog.c:9:46: error: stray '\200' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                              ^
prog.c:9:47: error: stray '\235' in program
    printf(\xe2\x80\x9c\xe5\x85\xb1\xe4\xbd\xbf\xe7\x94\xa8\xe4\xba\x86 %d \xe7\xa8\xae\xe8\x8b\xb1\xe6\x96\x87\xe5\xad\x97\xe6\xaf\x8d\xe2\x80\x9d, count(str, key));
                                               ^
prog.c: At top level:
prog.c:13:24: error: expected ';', ',' or ')' before 'str'
 int count(const char[] str)
                        ^~~
0 0
prog.c: In function 'main':
prog.c:6:15: warning: missing terminating " character
     for(;ch1!=";)
               ^
prog.c:6:15: error: missing terminating " character
     for(;ch1!=";)
               ^~~
prog.c:7:5: error: expected expression before '{' token
     {
     ^
prog.c:21:5: error: expected declaration or statement at end of input
     }
     ^
0 喜歡 0 不喜歡
內容已隱藏
** * ** ** * * **
int main ()
{
* * **** * ** *** *** **
* * * * * ** ** * ****** *** ** *
* ** ******************
***** * * * * * * * *** **** 0;
}
最新回答 用戶: (215 分)
修改於 用戶:
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>
int main(void)
{
* * ***** * * ** * ** * **** * *** * ** ** *** ** ** last=0,cnt=0,num;
       while(1)
     {
* ** *** * * ** * *** ** ** * * * *** *** * * *** ***** ** input number");
* * **** * ** ** ** *** * ** *** * **** **** * * * *****
* ** *** ***** * ** * ***** **** *** * * * *** ** **
* * * * ** *** * ** ****** ** **** *** * * ** * * *** * *
* * * **** * * **** ** * *** * *** * * * * * * * **** * * *** * *** * * * ** ** * *** * *
** ** ***** *** ** *** ** * * * * * *** * * *
   }
* * * **** * * * * * ** * * * *** * * *** ** ****** * ** ** * *** * ** ****** ** * ** **** * ****
** * ****** * * * ** ******** * ***** ** *** *** * * * ** ** * * ** * ** *** ***** ** ** * * * * ** ** ** **
**** ***** * *** * ** ** ** *** * *** 0;
}
最新回答 用戶: (190 分)
0 0
prog.c: In function 'main':
prog.c:13:4: error: expected expression before '}' token
    }
    ^
prog.c:14:26: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int *' [-Wformat=]
                 printf("%d\n",&num);
                          ^
prog.c:15:17: warning: implicit declaration of function 'system' [-Wimplicit-function-declaration]
                 system("pause");
                 ^~~~~~
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.89
©2016-2024

相關問題

2 喜歡 0 不喜歡
8 回答
[正常] Coding (C) - 最新提問 12月 20, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38155 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 525 瀏覽
2 喜歡 0 不喜歡
5 回答
[正常] 開放式問答 - 最新提問 12月 20, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38147 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 237 瀏覽
12,783 問題
183,443 回答
172,219 留言
4,824 用戶