DavidVictor2004's blog

By DavidVictor2004, history, 3 years ago, In English

Hello all, I get the error exit code 1 for the following test. Can you help me understanding why? Thanks in advance! https://codeforces.com/contest/1547/submission/126455872

alfabet=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","z"]

k=int(input())

while k > 0: y=1 stringul=input() if y==0: print("NO") else:
pozitia=stringul.find("a", 0, len(stringul)) if pozitia>-1: dreapta=pozitia stanga=pozitia else: y=0 for i in range(1, len(stringul)): pozitia=stringul.find(alfabet[i], 0, len(stringul)) dif_d=pozitia-dreapta dif_s=stanga-pozitia

if dif_d==1 and pozitia>-1: dreapta=pozitia

elif dif_s==1 and pozitia>-1: stanga=pozitia

else: y=0 i=len(stringul)

if y==1: print("YES") else: print("NO") k=k-1

  • Vote: I like it
  • -1
  • Vote: I do not like it

| Write comment?