public boolean wordBreak(String s, Set<String> dict) {
    	int length = s.length();
    	Boolean[] checked = new Boolean[length + 1];
    	
    	checked[0] = true;
       for(int i = 1; i < length + 1; i++){
    	   checked[i] = false;
    	   for(int j = 1; j <= i && j <= maxLength(dict); j++){
    		   if(checked[i - j] == true && dict.contains(s.substring(i - j,i))){
    				   checked[i] = true;
        			   break;
    		   }
    		   else{
    			   continue;
    		   }
    			   
    	   }
    	   
        }
    	
    		
    	return checked[length];
    	
    }