Language: C++

;#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  map<int,int> m;
  priority_queue<int> pq;
  bool flag=S.at(0)=='E'?false:true;
  int n=0;
  int I=-1;
  for(int i=0;i<N;i++){
    if(S.at(i)=='E'){
      if(!flag){
        n++;
        m[n]=i;
        pq.push(n);
      }else{
        m[n]=I;
        pq.push(n);
        n=1;
        m[n]=i;
        pq.push(n);
        flag=false;
      }
    }else{
      if(!flag){
        n++;
        I=i;
        pq.push(n);
        flag=true;
      }else{
        n++;
        m[n]=i;
        pq.push(n);
      }
    }
  }
  int x=m.at(pq.top());
  int64_t ans=0;
  for(int i=0;i<N;i++){
    if(i<x){
      if(S.at(i)=='W'){
        ans++;
      }
    }else if(i>x){
      if(S.at(i)=='E'){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | ;#include <bits/stdc++.h>
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | ;#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> N;
      |   ^~~
a.cc:7:3: error: 'string' was not declared in this scope
    7 |   string S;
      |   ^~~~~~
a.cc:8:10: error: 'S' was not declared in this scope
    8 |   cin >> S;
      |          ^
a.cc:9:3: error: 'map' was not declared in this scope
    9 |   map<int,int> m;
      |   ^~~
a.cc:9:7: error: expected primary-expression before 'int'
    9 |   map<int,int> m;
      |       ^~~
a.cc:10:3: error: 'priority_queue' was not declared in this scope
   10 |   priority_queue<int> pq;
      |   ^~~~~~~~~~~~~~
a.cc:10:18: error: expected primary-expression before 'int'
   10 |   priority_queue<int> pq;
      |                  ^~~
a.cc:18:9: error: 'm' was not declared in this scope
   18 |         m[n]=i;
      |         ^
a.cc:19:9: error: 'pq' was not declared in this scope
   19 |         pq.push(n);
      |         ^~
a.cc:21:9: error: 'm' was not declared in this scope
   21 |         m[n]=I;
      |         ^
a.cc:22:9: error: 'pq' was not declared in this scope
   22 |         pq.push(n);
      |         ^~
a.cc:32:9: error: 'pq' was not declared in this scope
   32 |         pq.push(n);
      |         ^~
a.cc:36:9: error: 'm' was not declared in this scope
   36 |         m[n]=i;
      |         ^
a.cc:37:9: error: 'pq' was not declared in this scope
   37 |         pq.push(n);
      |         ^~
a.cc:41:9: error: 'm' was not declared in this scope
   41 |   int x=m.at(pq.top());
      |         ^
a.cc:41:14: error: 'pq' was not declared in this scope
   41 |   int x=m.at(pq.top());
      |              ^~
a.cc:42:3: error: 'int64_t' was not declared in this scope
   42 |   int64_t ans=0;
      |   ^~~~~~~
a.cc:1:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 | ;#include <bits/stdc++.h>
a.cc:46:9: error: 'ans' was not declared in this scope
   46 |         ans++;
      |         ^~~
a.cc:50:9: error: 'ans' was not declared in this scope
   50 |         ans++;
      |         ^~~
a.cc:54:3: error: 'cout' was not declared in this scope
   54 |   cout << ans << endl;
      |   ^~~~
a.cc:54:11: error: 'ans' was not declared in this scope
   54 |   cout << ans << endl;
      |           ^~~
a.cc:54:18: error: 'endl' was not declared in this scope
   54 |   cout << ans << endl;
      |                  ^~~~