You are viewing a single comment's thread. Return to all comments →
def happyLadyBugs(b): for i in b: if i != "_" and b.count(i) == 1: return "NO" break if (b.count("_") > 0): return "YES" z = list(zip(b, b[1:], b[2:])) return "YES" if all(map(lambda t: t[1]==t[0] or t[1]==t[2], z)) else "NO" g = int(input()) for i in range(g): n = int(input()) b = input() result = happyLadyBugs(b) print(result)
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →
for Python3 Platform