finding lastChar faster