Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
131230 郑景文 统计字符数量 C++ Compile Error 0 MS 0 KB 304 2025-09-21 15:16:17

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int b[123]; char a[1000]; cin>>a; for(int i=0;i<1000;i++){ if(a[i]=='\0')break; b[a[i]]++; } int max=0,max_i=-1; for(int i=97;i=123;i++){ if(b[i]>max){ max=b[i]; max_i=i } } cout<<char(max_i)<<" "<<max; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:9:9: warning: array subscript has type 'char' [-Wchar-subscripts]
   b[a[i]]++;
         ^
Main.cc:12:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  for(int i=97;i=123;i++){
                 ^
Main.cc:16:3: error: expected ';' before '}' token
   }
   ^