remove duplicate numbers in array
string matching by KMP