Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6236 张育斌 统计字符数量 C++ Compile Error 0 MS 0 KB 565 2025-01-14 15:05:37

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int t[125]={}; char ch[1001]; cin>>ch; for(int i=0;;ch[i]='\0';i++){ t[ch[i]]++; } int _max=-1,t_num=0 for(int i=97;i<=122;i++){ if(t[i]>_max) { _max=t[i]; t_num=i; } } cout<<char(t_num)<<" "<<_max; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:28: error: expected ')' before ';' token
     for(int i=0;;ch[i]='\0';i++){
                            ^
Main.cc:11:29: error: 'i' was not declared in this scope
     for(int i=0;;ch[i]='\0';i++){
                             ^
Main.cc:11:32: error: expected ';' before ')' token
     for(int i=0;;ch[i]='\0';i++){
                                ^
Main.cc:15:5: error: expected ',' or ';' before 'for'
     for(int i=97;i<=122;i++){
     ^
Main.cc:15:28: error: expected ';' before ')' token
     for(int i=97;i<=122;i++){
                            ^
Main.cc:8:9: warning: unused variable 't' [-Wunused-variable]
     int t[125]={};
         ^
Main.cc:14:9: warning: unused variable '_max' [-Wunused-variable]
     int _max=-1,t_num=0
         ^
Main.cc:14:17: warning: unused variable 't_num' [-Wunused-variable]
     int _max=-1,t_num=0
                 ^
Main.cc:23:1: error: expected '}' at end of input
 }
 ^