Solution for reverse a string