```
class Solution(object):
def checkValidString(self, s):
"""
:type s: str
:rtype: bool
"""
def check(s, para):
t, total = 0, 0
for i, ch in enumerate(s):
if ch == para[0]: t += 1
elif ch == para[1]: t -= 1
else: total += 1
if t < 0 and total+t < 0: return False
if t > 0 and t-total > 0: return False
return True
return check(s, ['(', ')']) and check(s[::-1], [')', '('])
```