接受一个只包含小写字母的字符串,然后输出该字符串反转后的字符串。(字符串长度不超过1000)
输入一行,为一个只包含小写字母的字符串。
输出该字符串反转后的字符串。
abcd
dcba
print(input()[::-1])
print(input().strip()[::-1])
while True: try: print(input()[::-1]) except EOFError: break
res="" for i in list(reversed(list(input()))): res += i print(res)
string = str(input()) def reverse(s): if s == "": return s else: return reverse(s[1:])+s[0] print(reverse(string))
print("".join(reversed(input())))
while True: try: s = str(input()) l = [] for i in s: l.append(i) f_s = ''.join(l[::-1]) print(f_s) except: break
astring = list(input()) result = [i for i in astring[::-1]] result = "".join(result) print(result)
str = input() print(str[::-1])
str=input() print(str[::-1])
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题