Problem Author: | Khoi Le |
Prepared by: | Khoi Le |
Edited by: | Hasan Saleh (MathModel) |
We've one of the conditions must hold :
appears before .
appears before .
observe that we can merge the two conditions by just checking if both and exists in the string .
def solve():
n=int(input())
s=input()
if('6' in s and '7' in s):
print("NO")
else:
print("YES")
for _ in range(int(input())):
solve()