public static boolean isValid(String s) {
		if (s == null || s.length() < 1) {
			return false;
		}
		Stack<Character> stack = new Stack<Character>();
		int i = 0;
		while (i < s.length()) {
			if (s.charAt(i) == '(' || s.charAt(i) == '[' || s.charAt(i) == '{') {
				stack.push(s.charAt(i));
			} else {
				if (!stack.isEmpty()) {
					char temp = stack.pop();
					if (!isPair(temp, s.charAt(i))) {
						return false;
					}
				}else{
				    return false;
				}
			}
			i++;
		}
		if (stack.isEmpty()) {
			return true;
		}
		return false;
	}