string reversal without using reverse