Preview:



a = "gegeekek"

n = len(a)
s = []
for i in range(n):
    
    s.append(a[i])
    
    while len(s)>=4 and  s[-4:] == ['g', 'e', 'e', 'k' ]:
        
        s.pop()
        s.pop()
        s.pop()
        s.pop()
        
        
     
    
    
if len(s) == 0:
    
    print("Yes")

else:
    
    print("NO")
    


        
        
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter