#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);}) #define wt(v) ({unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);}) #define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);}) int t[500001]; int n; int main(){ rd_init(); int z=0; int i=0; for(int c;c=*rp++,c!=10;++i){ if(c=='<'){ ++n; t[n]=0; } if(c=='='){ t[n]+=1; } if(c=='>'){ if(n){ if(t[n]){ z+=t[n]+2; --n; }else{ n=0; } } } } wt1(i-z); _exit(0); }