def reverse_string(s): # 确保输入字符串仅包含小写字母 assert all(c.islower() for c in s), "输入字符串必须只包含小写字母" # 使用切片操作翻转字符串 reversed_s = s[::-1] return reversed_s # 示例 input_string = str(input()) output_string = reverse_string(input_string) print(output_string)
def reverse_string(s): # 确保输入字符串仅包含小写字母 assert all(c.islower() for c in s), "输入字符串必须只包含小写字母" # 使用切片操作翻转字符串 reversed_s = s[::-1] return reversed_s # 示例 input_string = str(input()) output_string = reverse_string(input_string) print(output_string)