to reverse an string input