You are viewing a single comment's thread. Return to all comments →
yes, u'r right just need to check two conditions:
def happy(n, b): for a in set(b): if a != "_" and b.count(a) == 1: return "NO" if b.count("_") == 0: for i in range(1,n-1): if b[i-1]!=b[i] and b[i+1]!=b[i]: return "NO" return "YES" for _ in range(int(input())): n = int(input()) b = input() print(happy(n, b))
pls like, if this code helps u
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 →
yes, u'r right just need to check two conditions:
pls like, if this code helps u