1547B — Alphabetical Strings exit code 1 error

Revision en1, by DavidVictor2004, 2021-08-19 18:18:19

Hello all, I get the error exit code 1 for the following test. Can you help me understanding why? Thanks in advance! https://codeforces.net/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

Tags #runtime error

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English DavidVictor2004 2021-08-19 18:18:46 6 Tiny change: '"y","z"]\nk=int(input())\nwhile k ' -> '"y","z"]\n\nk=int(input())\n\nwhile k '
en1 English DavidVictor2004 2021-08-19 18:18:19 922 Initial revision (published)