String reverse without using string buffer