Language: C++

#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;

struct Ses{
    int st, en, si;
};

int main{
    string str;
    cin >> str;
    int n = str.size();
    int Am = 0;
    Ses Km;
    stack<Ses> Em;
    stack<int> F;

    for(int i = 0; i < n; i++){
        if(str[i] == \\){
            F.push(i);
        }
        if(str[i] == /){
            if(!F.empty()){
                int a = F.top();
                F.pop();
                Km.st = a;
                Km.en = i;
                Km.si = i - a;
                Am += i - a;
                While ( !Em.empty() ){
                    if( Km.st < Em.top().st){
                        Km.si += Em.top().si;
                        Em.pop();
                    }
                    else{
                        break;
                    }
                }
                Em.push(Km);
            }
        }
    }
    cout << Am << endl;
    int Mn = Em.size();
    int A[Mn];

    for(int i = 0; i < Mn; i++){
        A[Mn - i - 1] = Em.top().area;
        Em.pop();
    }
    
    cout << Mn;

    for(int i = 0; i < Mn; i++){
        cout << " " << A[i];
    }
    
    cout << endl;
}

Compiler output:
a.cc:20:22: error: stray '\' in program
   20 |         if(str[i] == \\){
      |                      ^
a.cc:20:23: error: stray '\' in program
   20 |         if(str[i] == \\){
      |                       ^
a.cc:10:5: error: cannot declare '::main' to be a global variable
   10 | int main{
      |     ^~~~
a.cc:11:12: error: expected primary-expression before 'str'
   11 |     string str;
      |            ^~~
a.cc:11:12: error: expected '}' before 'str'
a.cc:10:9: note: to match this '{'
   10 | int main{
      |         ^
a.cc:12:5: error: 'cin' does not name a type
   12 |     cin >> str;
      |     ^~~
a.cc:13:13: error: 'str' was not declared in this scope; did you mean 'std'?
   13 |     int n = str.size();
      |             ^~~
      |             std
a.cc:19:5: error: expected unqualified-id before 'for'
   19 |     for(int i = 0; i < n; i++){
      |     ^~~
a.cc:19:20: error: 'i' does not name a type
   19 |     for(int i = 0; i < n; i++){
      |                    ^
a.cc:19:27: error: 'i' does not name a type
   19 |     for(int i = 0; i < n; i++){
      |                           ^
a.cc:44:5: error: 'cout' does not name a type
   44 |     cout << Am << endl;
      |     ^~~~
a.cc:46:11: error: size of array 'A' is not an integral constant-expression
   46 |     int A[Mn];
      |           ^~
a.cc:48:5: error: expected unqualified-id before 'for'
   48 |     for(int i = 0; i < Mn; i++){
      |     ^~~
a.cc:48:20: error: 'i' does not name a type
   48 |     for(int i = 0; i < Mn; i++){
      |                    ^
a.cc:48:28: error: 'i' does not name a type
   48 |     for(int i = 0; i < Mn; i++){
      |                            ^
a.cc:53:5: error: 'cout' does not name a type
   53 |     cout << Mn;
      |     ^~~~
a.cc:55:5: error: expected unqualified-id before 'for'
   55 |     for(int i = 0; i < Mn; i++){
      |     ^~~
a.cc:55:20: error: 'i' does not name a type
   55 |     for(int i = 0; i < Mn; i++){
      |                    ^
a.cc:55:28: error: 'i' does not name a type
   55 |     for(int i = 0; i < Mn; i++){
      |                            ^
a.cc:59:5: error: 'cout' does not name a type
   59 |     cout << endl;
      |     ^~~~
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^