need to implement indexOf by BM algorithm