A(模拟)
题目大意
输入输出
题目思路
- 枚举下标i,从左往右枚举,直到出现重复字符
- 判断s[i + 1:] 是否是回文串
- 注意:题目中说a和b是非空的
题目代码
from sys import stdin, setrecursionlimit
setrecursionlimit(100000)
input = lambda: stdin.readline().strip()
r1 = lambda: int(input())
r2 = lambda: map(int, input().split())
r3 = lambda: [*map(int, input().split())]
def solve():
s = input()
if len(s) == 1:
print("NaN")
return
st = set()
for i,x in enumerate(s):
if x in st:
break
if s[i + 1:] == s[i + 1:][::-1]:
print("HE")
return
st.add(x)
print("NaN")
if __name__ == '__main__':
t = r1()
for _ in range(t):
solve()
标签:__,特训,int,暑期,st,2023,print,input,lambda
From: https://www.cnblogs.com/gebeng/p/18304684