#include <string.h>
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param s string字符串
* @return bool布尔型
*/
bool isValid(char* s ) {
// write code here
int stack[5000];
int idx = -1;
int len = strlen(s);
for(int i = 0; i < len; i++) {
if(s[i] == '(' || s[i] == '[' || s[i] == '{') stack[++idx] = s[i];
else if(s[i] == ')' && stack[idx] == '(') idx--;
else if(s[i] == ']' && stack[idx] == '[') idx--;
else if(s[i] == '}' && stack[idx] == '{') idx--;
else return false;
}
if(idx == -1) return true;
return false;
}