finished the method for testing reverse string