Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
82075 张之隽 统计字符数量 C++ Compile Error 0 MS 0 KB 317 2024-07-12 17:02:21

Tests(0/0):


Code:

#include<iostream> #include<cstring> using namespace std; int main(){ char s[1000000]; int sn[150],n; cin>>n; int sl=strlen(n); for(int i=0;i<sl;i++) { sn[ s[i] ]++ } int max=0,k; for(int j='a';j<='z';j++){ if(max<sn[j]){ max=sn[j]; k=j; } } cout<<char(k)<<' '<<max; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:16: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
 int sl=strlen(n); 
                ^
In file included from /usr/include/c++/5/cstring:42:0,
                 from Main.cc:2:
/usr/include/string.h:394:15: note:   initializing argument 1 of 'size_t strlen(const char*)'
 extern size_t strlen (const char *__s)
               ^
Main.cc:10:10: warning: array subscript has type 'char' [-Wchar-subscripts]
 sn[ s[i] ]++
          ^
Main.cc:11:1: error: expected ';' before '}' token
 } 
 ^