bool Invalid(const char* pstr) {
int i = 0;
char lastchar;
if(pstr == NULL || pstr[0] == NULL)
return false;
InitStack(S);
lastchar = pstrp[i++];
Push(S, lastchar);
while(pstr[i] != NULL) {
if(IsPair(lastchar, pstr[i]) )
Pop();
else
Push(S, pstr[i]);
i++;
}
return IsEmpty(s);
}