ABC381 - B - 1122 String
問題
$ 2つずつ取り出して同じ文字かと既出の文字かを判定する。
iter() + zip()を使うと$ 2つずつfor文で取り出せる。端数がある場合、その分は無視されるので使わないこと。
code: b.py
S = input()
def check():
if len(S) % 2: return False
xS = iter(S)
T = set()
for a, b in zip(xS, xS):
if a in T: return False
if a != b: return False
T.add(a)
return True
print("Yes" if check() else "No")