Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6237 郑元泰 统计字符数量 C++ Compile Error 0 MS 0 KB 399 2025-01-14 15:06:46

Tests(0/0):


Code:

# include<iostream> using namespace std; int main(){ int t[125]={};//97号之前的不用,97-122 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:8:16: warning: array subscript has type 'char' [-Wchar-subscripts]
         t[ch[i]]++;
                ^
Main.cc:17:24: error: unable to find string literal operator 'operator"" _max'
     cout<char(t_num)<<" "_max;
                        ^