added three methods to reverse the string