mycode   95.76%

class Solution(object):
    def isValid(self, s):
        """
        :type s: str
        :rtype: bool
        """
        dic = {')':'(', '}':'{', ']':'['}
        res = []
        for i in s:
            if i in dic.keys():
                if res == [] or dic[i] != res[-1]:
                    return False
                res.pop()
            else:
                res.append(i)
        return res == []