```
class Solution:
# @param s, a string
# @param dict, a set of string
# @return a boolean
def wordBreak(self, s, dict):
indict = [False]* len(s)
for i in range(len(s)):
for j in range(i+1):
if (j ==0 or indict[j-1]) and s[j:i+1] in dict:
indict[i] = True
return indict[-1]
```