Language: C++

#include <bits/stdc++.h> 
using namespace std;
 
int main(){
    int N;
    scanf(%d,&N);
    sting S;
    scanf(%s,&S);
    
    int ans = 0;
    for(int i = 1;i<N;i++){
        int cnt = 0;
 
        for(char = 'a';c<='z';c++){
            bool left = false,right = false;
 
            for(int j = 0;j<i;j++){
                if(s[j]==c) left = true;
            }
            for(int k = i;k<n;k++){
                if(s[j]==c) right = true;
            }
            
            if(left&&right) cnt++;
        }
        if(ans<cnt) ans = cnt;
    
    }
    printf(%d,ans);
}
#include <bits/stdc++.h> 
using namespace std;

int main(){
    int N;
    scanf(%d,&N);
    sting S;
    scanf(%s,&S);
    
    int ans = 0;
    for(int i = 1;i<N;i++){
        int cnt = 0;

        for(char = 'a';c<='z';c++){
            bool left = false,right = false;

            for(int j = 0;j<i;j++){
                if(s[j]==c) left = true;
            }
            for(int k = i;k<n;k++){
                if(s[j]==c) right = true;
            }
            
            if(left&&right) cnt++;
        }
        if(ans<cnt) ans = cnt;
    
    }
    printf(%d,ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: expected primary-expression before '%' token
    6 |     scanf(%d,&N);
      |           ^
a.cc:6:12: error: 'd' was not declared in this scope
    6 |     scanf(%d,&N);
      |            ^
a.cc:7:5: error: 'sting' was not declared in this scope
    7 |     sting S;
      |     ^~~~~
a.cc:8:11: error: expected primary-expression before '%' token
    8 |     scanf(%s,&S);
      |           ^
a.cc:8:12: error: 's' was not declared in this scope
    8 |     scanf(%s,&S);
      |            ^
a.cc:8:15: error: 'S' was not declared in this scope
    8 |     scanf(%s,&S);
      |               ^
a.cc:14:18: error: expected unqualified-id before '=' token
   14 |         for(char = 'a';c<='z';c++){
      |                  ^
a.cc:14:17: error: expected ';' before '=' token
   14 |         for(char = 'a';c<='z';c++){
      |                 ^~
      |                 ;
a.cc:14:18: error: expected primary-expression before '=' token
   14 |         for(char = 'a';c<='z';c++){
      |                  ^
a.cc:14:24: error: 'c' was not declared in this scope
   14 |         for(char = 'a';c<='z';c++){
      |                        ^
a.cc:14:30: error: expected ')' before ';' token
   14 |         for(char = 'a';c<='z';c++){
      |            ~                 ^
      |                              )
a.cc:14:31: error: 'c' was not declared in this scope
   14 |         for(char = 'a';c<='z';c++){
      |                               ^
a.cc:29:12: error: expected primary-expression before '%' token
   29 |     printf(%d,ans);
      |            ^
a.cc: At global scope:
a.cc:34:5: error: redefinition of 'int main()'
   34 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:36:11: error: expected primary-expression before '%' token
   36 |     scanf(%d,&N);
      |           ^
a.cc:36:12: error: 'd' was not declared in this scope
   36 |     scanf(%d,&N);
      |            ^
a.cc:37:5: error: 'sting' was not declared in this scope
   37 |     sting S;
      |     ^~~~~
a.cc:38:11: error: expected primary-expression before '%' token
   38 |     scanf(%s,&S);
      |           ^
a.cc:38:12: error: 's' was not declared in this scope
   38 |     scanf(%s,&S);
      |            ^
a.cc:38:15: error: 'S' was not declared in this scope
   38 |     scanf(%s,&S);
      |               ^
a.cc:44:18: error: expected unqualified-id before '=' token
   44 |         for(char = 'a';c<='z';c++){
      |                  ^
a.cc:44:17: error: expected ';' before '=' token
   44 |         for(char = 'a';c<='z';c++){
      |                 ^~
      |                 ;
a.cc:44:18: error: expected primary-expression before '=' token
   44 |         for(char = 'a';c<='z';c++){
      |                  ^
a.cc:44:24: error: 'c' was not declared in this scope
   44 |         for(char = 'a';c<='z';c++){
      |                        ^
a.cc:44:30: error: expected ')' before ';' token
   44 |         for(char = 'a';c<='z';c++){
      |            ~                 ^
      |                              )
a.cc:44:31: error: 'c' was not declared in this scope
   44 |         for(char = 'a';c<='z';c++){
      |                               ^
a.cc:59:12: error: expected primary-expression before '%' token
   59 |     printf(%d,ans);
      |            ^