Update kmp.cpp

fix wrong index of T