public static int kmp(String pattern, String text){
		int i=0, j = 0;
		int[] lps = new int[pattern.length()];
		
		computeLongestPrefixSuffix(pattern, lps);
		
		for(int k = 0; k<lps.length; k++){
			System.out.print(lps[k] + " ");
		}
		System.out.println();
		while(i < text.length() && j < pattern.length()){
			//compare text[i] and pattern[j]
			if(text.charAt(i) == pattern.charAt(j)){
				i++;
				j++;
			}
			
			
			else if(text.charAt(i) != pattern.charAt(j)){
				if(j != 0){
					j = lps[j-1];
				}else{
					i = i+1;
				}
				
			}
			
		}
		if(j == pattern.length()){
			System.out.println("Found pattern at index " + (i-j));
		}
		
		if(j == pattern.length()){
			return i - j;
		}else{
			return -1;
		}
	}