回文基数 (O(√n)) ref: http://qiita.com/cielavenir/items/3d2bea62d301a2309884