public static boolean wordBreak(String s, Set<String> dict) {
		if(dict.size() <=0) return false;
		Pattern pattern;
		Matcher matcher;
		Iterator<String> iterator=dict.iterator();
		while(iterator.hasNext()){
			pattern=Pattern.compile(iterator.next());
			matcher= pattern.matcher(s);
			s=matcher.replaceAll("");
		}
		if(s.equals("")) 
			return true;
		return false;
    }