#include <stdio.h>#include <iostream>#include <string.h>#include <limits.h>#include <algorithm>#include <math.h>#include <numeric>#include <functional>#include <ctype.h>#include <stack>using namespace std;int main(void){ stack<char> mstack; int ncases; char str[200]; scanf("%d",&ncases); getchar(); for(int nc=1;nc<=ncases;++nc) { gets(str); int len=strlen(str); while(!mstack.empty()) mstack.pop(); int total=0,maxlen=0; for(int i=0;i<len;++i) if(str[i]=='[') { mstack.push('['); ++total; maxlen=max(total,maxlen); } else { --total; mstack.pop(); } printf("%d %dn",nc,1<<maxlen); } return 0;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)