Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
82078 陈俊洁 统计字符数量 C++ Compile Error 0 MS 0 KB 293 2024-07-12 17:03:01

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; char s[1000000]; int sn[150]; int main() { cin>>s; int s_l=strlen(s); for(int i=0;i<s_l;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; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:9:10: warning: array subscript has type 'char' [-Wchar-subscripts]
   sn[s[i]]++;
          ^
Main.cc:12:2: error: expected initializer before 'for'
  for(int j='a';j<='z';j++){
  ^
Main.cc:12:16: error: 'j' was not declared in this scope
  for(int j='a';j<='z';j++){
                ^
Main.cc:18:13: error: 'k' was not declared in this scope
  cout<