public static int[] matchingStatistics(String text, String pattern){
		SuffixTree st = new SuffixTree(pattern);
		//st.root.parent = st.root;
		st.root.suffixLink = st.root;
		SuffixTreeNode current = st.root;
		st.root.cut = -1;
		int position = -1;
		int[] ms = new int[text.length()];
		for(int i=0;i<text.length();i++){
			int count = 0;
			current = current.parent.suffixLink;	
			position = current.cut;
			log.debug("Now i = "+i+" current = "+current);
			for(int j=i;j<text.length();j++){
					
				if(current.end == position){
					SuffixTreeNode child = st.searchEndChild(current, text.charAt(j));
					if(child==null){
						ms[i] = count;
						log.debug("ms["+i+"] = "+ms[i]);
						break;
					}
					current = child;
					position = child.cut;
					count++;
					if(j<text.length()-1)
						continue;
				}
				if(text.charAt(j)!=pattern.charAt(++position)){
					ms[i] = count;
					log.debug("ms["+i+"] = "+ms[i]);
					break;
				}else{
					count++;
				}
				ms[i] = count;
				log.debug("ms["+i+"] = "+ms[i]);
			}
		}
		return ms;
		
	}