Compile Error

foo.cc: In function 'int countChar(std::string)':
foo.cc:17:15: error: 'b' was not declared in this scope
   17 |   while(rk<n&&b(s1,s[rk])==0)
      |               ^
foo.cc:6:7: warning: unused variable 't' [-Wunused-variable]
    6 |   int t,i,n,len,rk;
      |       ^
foo.cc:27:2: warning: no return statement in function returning non-void [-Wreturn-type]
   27 |  }
      |  ^
foo.cc: At global scope:
foo.cc:29:5: error: expected initializer before 'int'
   29 |     int i,left,right,n;
      |     ^~~
foo.cc:30:5: error: 'n' does not name a type; did you mean 'yn'?
   30 |     n=s.length();
      |     ^
      |     yn
foo.cc:31:5: error: expected unqualified-id before 'if'
   31 |     if(k<2)
      |     ^~
foo.cc:35:8: error: expected unqualified-id before 'if'
   35 |        if(n<k)
      |        ^~
foo.cc:40:5: error: expected unqualified-id before 'for'
   40 |     for(i=0;i<n;i++)
      |     ^~~
foo.cc:40:13: error: 'i' does not name a type
   40 |     for(i=0;i<n;i++)
      |             ^
foo.cc:40:17: error: 'i' does not name a type
   40 |     for(i=0;i<n;i++)
      |                 ^
foo.cc:44:5: error: 'i' does not name a type
   44 |     i=0;
      |     ^
foo.cc:45:5: error: expected unqualified-id before 'while'
   45 |     while(i<n&&ch[s[i]-'a']>=k)
      |     ^~~~~
foo.cc:49:5: error: expected unqualified-id before 'if'
   49 |     if(i==n)
      |     ^~
foo.cc:53:5: error: 'left' does not name a type
   53 |     left=countChar(s.substr(0,i),k);
      |     ^~~~
foo.cc:54:5: error: expected unqualified-id before 'while'
   54 |     while(i<n&&ch[s[i]-'a']<k)
      |     ^~~~~
foo.cc:58:6: error: 'right' does not name a type
   58 |      right=countChar(s.substr(i),k);
      |      ^~~~~
foo.cc:59:2: error: expected unqualified-id before 'return'
   59 |  return max(left,right)
      |  ^~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1108 无重复最长子串
语言
C++
递交时间
2022-07-18 15:04:29
评测时间
2022-07-18 15:04:29
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes