@Override
	public StringMatcher initialize(String pattern) {
		m = pattern.length();
		R = new LinkedList<Integer>();
		q = 0;
		delta = new TreeMap<Integer, TreeMap<Character,Integer>>();
		Set<Character> alphabet = new HashSet<Character>();
		for (char i=32; i<=126; i++) alphabet.add(i);
//		for (char i : pattern.toCharArray()) {
//			alphabet.add(i);
//		}
		
		for (int j=0; j<=m; j++) {
			for (char c : alphabet) {
				int k = Math.min(m, j+1);
				for (;;) {

					StringBuilder part2builder = new StringBuilder();
					
					for (int i = j-k+2; i<=j; i++) {
						part2builder.append(pattern.charAt(i-1));
					}
					part2builder.append(c);
					
					CharSequence p1 = pattern.subSequence(0, k);
					CharSequence p2 = part2builder.toString();
					
					if (k>0 && !p1.equals(p2)) {
						k--;
						continue;
					}
					break;
				}
				
				if (!delta.containsKey((Integer) j)) {
					delta.put(j,new TreeMap<Character, Integer>());
				}
				delta.get(j).put(c, k);
			}
		}
		
		return this;
	}