Language: C

#include<stdio.h>
#include<string.h>
#define N 20000
typedef struct Data{
  int area,posi;
}Data;
 
Data t[N];
int u[N],n,i,T,U,ans,A;
char str1[N+1];
 
Data X,Y;

int main(){
  init();
  scanf("%s",str1);
  n=strlen(str1);
 
  for(i=0;i<n;i++){
 
    if(str1[i]=='/'){
      if(U==0)
    continue;
    A=pop();
    X=mkData(i-A,A);
    ans+=i-A;
    while(T>0){
      Y=Dpop();
      if(Y.posi<A){
        Dpush(Y);
        break;
      }
      X.area+=Y.area;
      if(Y.posi<X.posi)
        X.posi=Y.posi;
    }
    Dpush(X);
    }
    else if(str1[i]=='\\'){
      push(i);
    }
  }
  printf("%d\n%d",ans,T);
  for(i=0;i<T;i++){
    printf(" ");
    printf("%d",t[i].area);
  }
  printf("\n");
  return 0;
}
void Dpush(Data data)
{
  t[T++]=data;
}
Data Dpop()
{
  return t[--T];
}
void push(int x)
{
  u[U++]=x;
}
int pop()
{
  return u[--U];
}
void init()
{
  ans=U=T=0;
}
 
Data mkData(int x,int y)
{
  Data res;
  res.area=x;
  res.posi=y;
 
  return res;
}

Compiler output:
main.c: In function 'main':
main.c:15:3: error: implicit declaration of function 'init' [-Wimplicit-function-declaration]
   15 |   init();
      |   ^~~~
main.c:24:7: error: implicit declaration of function 'pop'; did you mean 'popen'? [-Wimplicit-function-declaration]
   24 |     A=pop();
      |       ^~~
      |       popen
main.c:25:7: error: implicit declaration of function 'mkData' [-Wimplicit-function-declaration]
   25 |     X=mkData(i-A,A);
      |       ^~~~~~
main.c:25:7: error: incompatible types when assigning to type 'Data' from type 'int'
main.c:28:9: error: implicit declaration of function 'Dpop' [-Wimplicit-function-declaration]
   28 |       Y=Dpop();
      |         ^~~~
main.c:28:9: error: incompatible types when assigning to type 'Data' from type 'int'
main.c:30:9: error: implicit declaration of function 'Dpush' [-Wimplicit-function-declaration]
   30 |         Dpush(Y);
      |         ^~~~~
main.c:40:7: error: implicit declaration of function 'push' [-Wimplicit-function-declaration]
   40 |       push(i);
      |       ^~~~
main.c: At top level:
main.c:51:6: warning: conflicting types for 'Dpush'; have 'void(Data)'
   51 | void Dpush(Data data)
      |      ^~~~~
main.c:30:9: note: previous implicit declaration of 'Dpush' with type 'void(Data)'
   30 |         Dpush(Y);
      |         ^~~~~
main.c:55:6: error: conflicting types for 'Dpop'; have 'Data()'
   55 | Data Dpop()
      |      ^~~~
main.c:28:9: note: previous implicit declaration of 'Dpop' with type 'int()'
   28 |       Y=Dpop();
      |         ^~~~
main.c:59:6: warning: conflicting types for 'push'; have 'void(int)'
   59 | void push(int x)
      |      ^~~~
main.c:40:7: note: previous implicit declaration of 'push' with type 'void(int)'
   40 |       push(i);
      |       ^~~~
main.c:67:6: warning: conflicting types for 'init'; have 'void()'
   67 | void init()
      |      ^~~~
main.c:15:3: note: previous implicit declaration of 'init' with type 'void()'
   15 |   init();
      |   ^~~~
main.c:72:6: error: conflicting types for 'mkData'; have 'Data(int,  int)'
   72 | Data mkData(int x,int y)
      |      ^~~~~~
main.c:25:7: note: previous implicit declaration of 'mkData' with type 'int()'
   25 |     X=mkData(i-A,A);
      |       ^~~~~~