n) { ans=maxn+10; flat=false; continue; } if(c=='{') { flat1=true; cnt=1; } else if(c=='}') { ans*=cnt; flat1=false; } else if(flat1&&c=='|') { cnt++; } else if(!flat2&&c=='$') { flat2=true; temp=1; cnt=1; } else if(flat2&&c=='$') { temp*=cnt; ans*=temp; flat2=false; } else if(flat2&&c==' ') { cnt++; } else if(flat2&&c!=' ') { temp*=cnt; cnt=1; } } } } if(ans>maxn)puts("doge"); else printf("%I64d\n",ans); } return 0; }
|