ZhenlongDai/ACPR huggingface dataset:
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
first = 0
last = 0
for i in range(0,len(s)):
    if s[i] == "A" and first == 0:
        first = i
    if s[i] == "Z":
        last = i
print(int(last - first + 1))

Failing test case input:
AGKFZKEAIOHG[DSAH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()
first = -1
last = -1
for i in range(0,len(s)):
    if s[i] == "A" and first == -1:
        first = i
    if s[i] == "Z":
        last = i
print(int(last - first + 1))

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
a = s.index('A')
z = s.index('Z')
print(z-a+1)

Failing test case input:
HASFJGHOGAKZZFEGA

Expected output:
12

Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
a = s.find('A')
z = s.rfind('Z')
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

for i in range(len(s)):
  if s[i] == "A":
    st = i-1
    break
for i in range(len(s)):
  if s[-i] == "Z":
    en = len(s)-i
    break;
print(en - st)

Failing test case input:
ZCAZB

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
sr = s[::-1]

for i in range(len(s)):
  if s[i] == "A" :
    st = i+1
    break

for i in range(len(s)):
  if sr[i] == "Z":
    en = len(s)-i
    break

print(en - st + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
stack = []
best_length = -float('inf')
for i,w in enumerate(s):
  if w=='A':
    stack.append(i)
  elif w=='Z' and stack:
    start = stack.pop()
    length = i - start + 1
    if length > best_length:
      best_length = length
print(best_length if best_length > 0 else 0)

Failing test case input:
HASZJGFOGAKGZFEIA

Expected output:
12


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()
start = -float('inf')
best_length = -float('inf')
for i,w in enumerate(s):
  if w=='A' and start < 0:
    start = i
  elif w=='Z' and start >= 0:
    length = i - start + 1
    if length > best_length:
      best_length = length
print(best_length if best_length > 0 else 0)

Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
start = s.find("A")
end = s[start:].find("Z")
print(end - start + 1)


Failing test case input:
ICAF[IFNGFKKZSHGB

Expected output:
11


Actual output:
9


Fixed submission (verdict: Accepted):
s = input()
start = s.find("A")
end = s.rfind("Z")
print(end - start + 1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=list(input())
a=0
z=0

for i in range(len(s)):
  if i=="A":
      a=i
      break

ss=s.reverse()
for i in range(len(s)):
    if i=="Z":
        z=i
        break
    
print(len(s)-(a+z))

Failing test case input:
HASHJGFOGAKZZFEHA

Expected output:
12


Actual output:
17


Fixed submission (verdict: Accepted):
s=list(input())
a=0
z=0

for i in range(len(s)):
  if s[i]=="A":
      a=i
      break

S=list(reversed(s))
for j in range(len(S)):
    if S[j]=="Z":
        z=j
        break

print(len(s)-a-z)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

if __name__ == '__main__':
  s = str(input())
  L = len(s)
  beg = -1
  end = -1
  for i in range(0,L):
    if s[i]=='A' and beg==-1:
      beg = i
    elif s[i]=='Z':
      end = i
  print(s[beg:end-beg+1])


Failing test case input:
HASE[GHOIAKKZFEGA

Expected output:
12


Actual output:
ASE[GHOIAKK


Fixed submission (verdict: Accepted):

if __name__ == '__main__':
  s = str(input())
  L = len(s)
  beg = -1
  end = -1
  for i in range(0,L):
    if s[i]=='A' and beg==-1:
      beg = i
    elif s[i]=='Z':
      end = i
  print(end-beg+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = str(input())
start = 0
end = 0
for i in range(len(s)):
    if s[i]=='A' and start==0:
        start = i
    if s[-(i+1)]=='Z' and end==0:
        end = len(s)-i
    if start != 0 and end != 0:
        break
print(end-start)

Failing test case input:
AIEFZ[KAGOGGJGSBH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
s = str(input())
start = 0
end = 0







for i in range(len(s)):
    if s[i]=='A':
        start = i
        break
for i in range(len(s)):
    if s[i]=='Z':
        end = i
print(end-start+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
x = ""
for i,k in enumerate(s):
    if k == "A":
        x = s[i:][::-1]
        for j,t in enumerate(x):
            if t == "Z":
                x = x[j:]
                
print(len(x))

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
1


Fixed submission (verdict: Accepted):
import re

s = input()
x = ""
for i,k in enumerate(s):
    if k == "A":
        x = s[i:][::-1]
        for j,t in enumerate(x):
            if t == "Z":
                x = x[j:]
                break
        break
                
print(len(x))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
line = input()
a = 20000000
z = 0
for i in range(len(line)):
  if line[i] == 'A':
    min(a,i)
  elif line[i] == 'Z':
    max(z,i)
print(z-a+1)

Failing test case input:
GASF[HHNG@KJZFEGA

Expected output:
12


Actual output:
-19999999


Fixed submission (verdict: Accepted):
line = input()
a = 20000000
z = 0
for i in range(len(line)):
  if line[i] == 'A':
    a = min(a,i)
  elif line[i] == 'Z':
    z = max(z,i)
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
n = len(s)

for i in range(n-1):
  if s[i] == "A":
    break
    
for j in range(n-1)[::-1]:
  if s[j] == "Z":
    break
    
print(len(s[i:j+1]))

Failing test case input:
BZACZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
n = len(s)

for i in range(n-1):
  if s[i] == "A":
    break
    
for j in range(1,n)[::-1]:
  if s[j] == "Z":
    break
    
print(len(s[i:j+1]))
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()

count = 0
top = 0
end = 0

while True:
    if S[count] == 'A':
        top = count
        break
    count += 1

count = -1
while True:
    if S[count] == 'Z':
        end = count
        break
    count -= 1

print(S[top:end + 1])



Failing test case input:
HARF[IHPGAKKZFEGA

Expected output:
12


Actual output:
ARF[IHPGAKKZ


Fixed submission (verdict: Accepted):
S = input()

count = 0
top = 0
end = 0

while True:
    if S[count] == 'A':
        top = count
        break
    count += 1

count = -1
while True:
    if S[count] == 'Z':
        end = count + 1
        break
    count -= 1

if end == 0:
    print(len(S[top:]))
else:
    print(len(S[top:end]))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

f = -1
b = -1
i = 0
n = len(s) - 1

while f == -1 or b == -1:
    if s[i] == 'A':
        f = i
    if s[n] == 'Z':
        b = n
    i = i + 1
    n = n - 1

print(b - f + 1)


Failing test case input:
AGEFZKKAGOHI[FSAH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()

f = -1
b = -1
i = 0
n = len(s) - 1

while f == -1:
    if s[i] == 'A':
        f = i
    i = i + 1

while b == -1:
    if s[n] == 'Z':
        b = n
    n = n - 1

print(b - f + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().strip()

a = 0
b = 0

for i in range(len(s)):
    if s[i] == 'A':
        a = i
    elif s[i] == 'Z':
        b = i
print(b-a+1)


Failing test case input:
HASHJGFOGAKZZFEGA

Expected output:
12


Actual output:
-3


Fixed submission (verdict: Accepted):
s = input().strip()

a = []
b = []

for i in range(len(s)):
    if s[i] == 'A':
        a.append(i)
    elif s[i] == 'Z':
        b.append(i)
print(max(b)-min(a)+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for j in range(len(r)):
    if r[j] == "Z":
        z = len(r) - j
        break
print(z-a+2)

Failing test case input:
IAAG[IHOGFKJZSFGB

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for j in range(len(r)):
    if r[j] == "Z":
        z = len(r) - j
        break
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=str(input())
s=list(s)
for i in range(0,len(s)):
  if s[i]=="A":
    temp1=i
    break    
for j in range(temp1+1,len(s)):
  if s[j]=="Z":
    temp2=j
    break 
print(temp2-temp1+1)

Failing test case input:
HASGJGFOGAKZZFEIA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s=str(input())
s=list(s)
for i in range(0,len(s)):
  if s[i]=="A":
    temp1=i
    break    
for j in range(0,len(s)-temp1):
  if s[len(s)-j-1]=="Z":
    temp2=len(s)-j-1
    break 
print(temp2-temp1+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
for i in range(len(s)):
    if s[i]=='A':
        a=i
for i in range(len(s)-1,0,-1):
    if s[i]=='Z':
        b=i
print(b-a+1)


Failing test case input:
HASFJGHOGAK[ZFEGA

Expected output:
12


Actual output:
-3


Fixed submission (verdict: Accepted):
s=list(input())
for i in range(len(s)):
    if s[i]=='A':
        a=i
        break
for i in range(len(s)-1,0,-1):
    if s[i]=='Z':
        b=i
        break
print(b-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
a = S.find('A')

b = S.find('Z')

print(len(S)-a-b)


Failing test case input:
IAAG[IHOGFKKZSFGB

Expected output:
12


Actual output:
4


Fixed submission (verdict: Accepted):
S = input()
a = S.find('A')

b = S[::-1].find('Z')

print(len(S)-a-b)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
b = 0
c = 0
d = False
for i in a:
     if i == "A" and b == 0:
           d = True
           b += 1
     if d == True:
          c += 1
     if i == "Z":
          d = False
print(c)


Failing test case input:
HASGJGFOGAKZZFEIA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
a = input()
b = 0
count = 0
d = 0 
e = []
flag = False
for i in a:
     if i == "A" and d == 0:
          b = count
          flag = True
          d += 1
     if i == "Z":
          e.append(count)
     count += 1
print(e[-1]-b+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()

mojiA=s.index("A")
mojiZ=s.index("Z")

d=s[mojiA:mojiZ+1]

print(len(d))


Failing test case input:
HASFJGHOGAKZZFEGA

Expected output:
12

Actual output:
11


Fixed submission (verdict: Accepted):
s=input()

mojiA=s.index("A")
mojiZ=s.rindex("Z")

d=s[mojiA:mojiZ+1]

print(len(d))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
num_A = 0
num_Z = 0
for ind,i in enumerate(s):
  if(num_A == 0 and i == 'A'):
    num_A = ind
  if(i == 'Z'):
    num_Z = ind
print(num_Z - num_A + 1)


Failing test case input:
AGEFZKKAGOHI[FSAH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()
num_A = -1
num_Z = -1
for ind,i in enumerate(s):
  if(num_A == -1 and i == 'A'):
    num_A = ind
  if(i == 'Z'):
    num_Z = ind
print(num_Z - num_A + 1)

Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
start = len(s)
end = 0

for i in range(len(s)):
    if s[i] == "A":
        start = min(start,i)
    if s[len(s)-1-i] == "Z":
        end = max(end,i)

print(len(s)-start-end)

Failing test case input:
HASHJGFOGAKZZFEHA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
start = len(s)
end = len(s)

for i in range(len(s)):
    if s[i] == "A":
        start = min(start,i)
    if s[len(s)-1-i] == "Z":
        end = min(end,i)

print(len(s)-start-end)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a=s.find("A")
b=s.rfind("Z")
print(s[a:b]) 

Failing test case input:
HASF\IHOGBKJZFEFA

Expected output:
12


Actual output:
ASF\IHOGBKJ


Fixed submission (verdict: Accepted):
s=input()
a=s.find("A")
b=s.rfind("Z")
print(b-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
rev=s[::-1]
n=len(s)
print(n)
print((n-rev.find('Z')) - (s.find('A')))


Failing test case input:
AGEFZKKAGOHI[FSAH

Expected output:
5


Actual output:
17
5


Fixed submission (verdict: Accepted):
s=input().strip()
rev=s[::-1]
n=len(s)

print((n-rev.find('Z')) - (s.find('A')))

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
string = input()
index_of_A = string.index("A")
index_of_Z = string.index("Z", index_of_A+1)

print(index_of_Z - index_of_A + 1)

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
4


Fixed submission (verdict: Accepted):
string = input()
index_of_A = string.index("A")
index_of_Z = string.rfind("Z")

print(index_of_Z - index_of_A + 1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()

st = 0
en = 0

for i in range(len(S)):
    if S[i] == "A" and st == 0:
        st = i

    if S[i] == "Z":
        en = i

print(en - st + 1)

Failing test case input:
AGEFZKKAIOHG[DSAH

Expected output:
5


Actual output:
-2


Fixed submission (verdict: Accepted):
S = input()

st = 0
en = 0

for i in range(len(S)):
    if S[i] == "A":
        st = i
        break

for i in range(len(S)):
    if S[i] == "Z":
        en = i

print(en - st + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
t = 0
u = 0
n = len(s)
for i in range(n):
  if s[i] == "A":
    t = i
    break
for j in range(n):
  if s[n-j-1] == "Z":
    u = n-j-1
print(u-t+1)

Failing test case input:
ZAACZ

Expected output:
4


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
t = 0
u = 0
n = len(s)
for i in range(n):
  if s[i] == "A":
    t = i
    break
for j in range(n):
  if s[n-j-1] == "Z":
    u = n-j-1
    break
print(u-t+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

start = s.index("A")

for i in range(start, len(s)):
    if s[i] == "Z":
        print(i - start + 1)
        break

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
4


Fixed submission (verdict: Accepted):
s = input()

start = s.index("A")

for i in range(len(s)-1, start, -1):
    if s[i] == "Z":
        print(i - start + 1)
        break
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s)

x = []

for i in range(n):
    if s[i] == 'A':
        x.append(i)
    elif s[i] == 'Z':
      x.append(i)
      
print(len(s[x[0]:x[1]]))

Failing test case input:
HASD[GHOIAKKZFEGA

Expected output:
12


Actual output:
8


Fixed submission (verdict: Accepted):
s = input()
n = len(s)

x = []

for i in range(n):
    if 'A' not in x and s[i] is 'A':
        x.append(i)
        x.append('A')
    elif 'A' in x and s[i] is 'Z':
        x.append(i)

print(x[-1] - x[0] + 1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
print(S.rfind('z')-S.find('a')+1)

Failing test case input:
IASG[IHPGFKGZAEKB

Expected output:
12


Actual output:
1


Fixed submission (verdict: Accepted):
S=input()
print(S.rfind('Z')-S.find('A')+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


s=input()
a=0
z=0

for i in range(len(s)):
    if a==0 and s[i]=="A":
        a=i
    elif s[i]=="Z":
        z=i
print(z-a+1)


Failing test case input:
AIEFZGKAFOFGJZSAH

Expected output:
14


Actual output:
7


Fixed submission (verdict: Accepted):


s=input()
a=-1
z=-1

for i in range(len(s)):
    if a==-1 and s[i]=="A":
        a=i
    elif s[i]=="Z":
        z=i
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = list(input())
start = 0
end = 0
for i in range(len(s)):
  if s[i] == "A":
    start = i
for i in reversed(range(len(s))):
  if s[i] == "Z":
    end = i
print(end - start + 1)

Failing test case input:
AGEFZJK@GNHH[FSAG

Expected output:
5


Actual output:
-10


Fixed submission (verdict: Accepted):
s = list(input())
start = 0
end = 0
len_s = len(s)
for i in range(len_s):
  if s[i] == "A":
    start = i
    break
    
for i in reversed(range(len_s)):
  if s[i] == "Z":
    end = i
    break
print(end - start + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=list(input())
a_id=S.index("A")
z_id=list(reversed(S)).index("Z")
print(z_id - a_id +1)

Failing test case input:
HASF[HHOGAKKZFEGA

Expected output:
12


Actual output:
4


Fixed submission (verdict: Accepted):
S=list(input())
l =len(S)
a_id=S.index("A")
z_id=list(reversed(S)).index("Z")
print(l-z_id - a_id)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = [i for i in input()]
index_Z = [i for i, x in enumerate(s) if x == 'Z']

print(max(index_Z) - s.index('A'))

Failing test case input:
HASHJGFOGAKZZFEHA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = [i for i in input()]
index_Z = [i for i, x in enumerate(s) if x == 'Z']

print(max(index_Z) - s.index('A') + 1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
b = 0
c = 0
d = False
for i in a:
     if i == "A" and b == 0:
           d = True
           b += 1
     if d == True:
          c += 1
     if i == "Z":
          d = False
          b = 0
print(c)

Failing test case input:
BJEAZGKFGPHH[GSAI

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
a = input()
b = 0
count = 0
d = 0 
e = []
flag = False
for i in a:
     if i == "A" and d == 0:
          b = count
          flag = True
          d += 1
     if i == "Z":
          e.append(count)
     count += 1
print(e[-1]-b+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
x = ""
for i,k in enumerate(s):
    if k == "A":
        x = s[i:][::-1]
        for i,t in enumerate(x):
            if t == "Z":
                x = x[i:]
                
print(len(x))

Failing test case input:
AGKFZKEAIOHG[DSAH

Expected output:
5


Actual output:
2


Fixed submission (verdict: Accepted):
import re

s = input()
x = ""
for i,k in enumerate(s):
    if k == "A":
        x = s[i:][::-1]
        for j,t in enumerate(x):
            if t == "Z":
                x = x[j:]
                break
        break
                
print(len(x))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for i in range(len(r)):
    if r[i] == "Z":
        z = len(r) - i
        break
print(z-a+2)

Failing test case input:
HARF[IHOGAKKZFEGA

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
s = list(input())
r = list(reversed(s))

for i in range(len(s)):
    if s[i] == "A":
        a = i +1
        break
for j in range(len(r)):
    if r[j] == "Z":
        z = len(r) - j
        break
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import re
s = str(input())
if len(s) < 0 or len(s) > 200000:
    sys.exit()

array_str = re.findall(r'A.*Z', s)
max = 0
for I in array_str:
    print(I)
    if len(I) > max:
        max = len(I)
print(max)


Failing test case input:
HASF[GHOIAKKZFEGA

Expected output:
12


Actual output:
ASF[GHOIAKKZ
12


Fixed submission (verdict: Accepted):
import sys
import re
s = str(input())
if len(s) < 0 or len(s) > 200000:
    sys.exit()

array_str = re.findall(r'A.*Z', s)
max = 0
for I in array_str:
    if len(I) > max:
        max = len(I)
print(max)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A':
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
      pos_z = i
      if pos_z - pos_a -1 > length:
        length = pos_z - pos_a -1
      else:
        flag = 0

print(length)

Failing test case input:
IASG[IHOGAKKZFEGB

Expected output:
12


Actual output:
2


Fixed submission (verdict: Accepted):
s = list(input())

flag = 0
pos_a, pos_z = 1, 1
length = 0

for i, ltr in enumerate(s, 1):
  if ltr == 'A' and flag == 0:
    pos_a = i
    flag = 1
  elif ltr == 'Z' and flag == 1:
    pos_z = i
    if pos_z - (pos_a -1) > length:
      length = pos_z - (pos_a -1)
    else:
      flag = 0

print(length)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s)

x = []

for i in range(n):
    if s[i] == 'A':
        x.append(i)
    elif s[i] == 'Z':
      x.append(i)
      
print(x)
print(len(s[x[0]:x[1]]))

Failing test case input:
TCAG[IHNGFGKZIFKB

Expected output:
11


Actual output:
[2, 12]
10


Fixed submission (verdict: Accepted):
s = input()
n = len(s)

x = []

for i in range(n):
    if 'A' not in x and s[i] is 'A':
        x.append(i)
        x.append('A')
    elif 'A' in x and s[i] is 'Z':
        x.append(i)

print(x[-1] - x[0] + 1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()

N = len(S)
Aflag = 0
Zflag = 0
for i in range(N):
    if Aflag == 0 and S[i] == 'A':
        Aflag = i
    elif S[i] == 'Z':
        Zflag = i

print(Zflag-Aflag+1)


Failing test case input:
AGEFZJG@GNHHZFSAK

Expected output:
13


Actual output:
-2


Fixed submission (verdict: Accepted):
S = input()

N = len(S)
Aflag = -1
Zflag = 0
for i in range(N):
    if Aflag == -1 and S[i] == 'A':
        Aflag = i
    elif S[i] == 'Z':
        Zflag = i

print(Zflag-Aflag+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a=0
z=0

for i in range(len(s)):
    if(s[i]=="A" and a<=i and i<=z):
        a=i
    elif(s[i]=="Z" and z<=i ):
        z=i

print(z-a)
        


Failing test case input:
IBAH[GHNGFKKZSFIA

Expected output:
11


Actual output:
12


Fixed submission (verdict: Accepted):
s=input()
a=200000
z=0
b=[]
for i in range(len(s)):
    if(s[i]=="A" and a>=i):
        b.append(i)
        a=i
    elif(s[i]=="Z" and z<=i ):
        z=i
print(z-a+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
start_flag = False
start = 200001
end = 200001
for i in range(len(S)):
    if S[i] == "A" and start_flag == False:
        start_flag = True
        start = i
    elif S[i] == "Z" and start_flag == True:
        end = i
        break
print(end-start+1)

Failing test case input:
HASHJGFOGAKZZFEGA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
S = input()
start_flag = False
z_count = S.count("Z")
start = 200001
end = 200001
for i in range(len(S)):
    if S[i] == "A" and start_flag == False:
        start_flag = True
        start = i
    elif S[i] == "Z":
        if z_count == 1 and start_flag == True:
            end = i
            break
        else:
            z_count -= 1
print(end-start+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = str(input())
start = 0
end = 0
for i in range(len(s)):
    if s[i]=='A' and start==0:
        start = i
    if s[-(i+1)]=='Z' and end==0:
        end = len(s)-i
print(end-start)

Failing test case input:
AGEFZJG@GNHH[FSAK

Expected output:
5


Actual output:
-10


Fixed submission (verdict: Accepted):
s = str(input())
start = 0
end = 0







for i in range(len(s)):
    if s[i]=='A':
        start = i
        break
for i in range(len(s)):
    if s[i]=='Z':
        end = i
print(end-start+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = s.find("a")
z = s.find("z")
print(z - a)

Failing test case input:
HASF\IHOGBKJZFEGA

Expected output:
12


Actual output:
0


Fixed submission (verdict: Accepted):
s = input()
a = s.find("A")
z = s.rfind("Z")
print(z - a + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=SI()
    for i in range(len(s)):
        if s[i]=="a":break
    for j in range(len(s)-1,-1,-1):
        if s[j]=="z":break
    print(j-i+1)

main()

Failing test case input:
SCAG[IHNGFKJZIEGB

Expected output:
11


Actual output:
-15


Fixed submission (verdict: Accepted):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=SI()
    for i in range(len(s)):
        if s[i]=="A":break
    for j in range(len(s)-1,-1,-1):
        if s[j]=="Z":break
    print(j-i+1)

main()
Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

a = s.find("A")
z = s.rfind("Z")

print(s[a:z + 1])

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
ASGZIIZ


Fixed submission (verdict: Accepted):
s = input()

a = s.find("A")
z = s.rfind("Z")

print(z - a + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
l,r=0,len(s)
for i in range(len(s)):
    if s[i]=='A':l=i;break
for i in range(len(s)):
    if s[len(s)-(i+1)]=='Z':r=len(s)-(i+1);break
print(r-l)

Failing test case input:
AGEFZKKAIOHG[DSAH

Expected output:
5


Actual output:
4


Fixed submission (verdict: Accepted):
s=list(input())
l,r=0,len(s)
for i in range(len(s)):
    if s[i]=='A':l=i;break
for i in range(len(s)):
    if s[len(s)-(i+1)]=='Z':r=len(s)-(i+1);break
print(r-l+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input ()
n = len (s)
print (n)
for i in range (n):
  if s[i] == 'A':
    x = i
    break
for i in range (n):
  print (s[-1-i])
  if s[-1-i] == 'Z':
    y = n-i-1
    break
print (x,y)
print (y-x+1)

Failing test case input:
HASF[HHOGAKJZFEGA

Expected output:
12


Actual output:
17
A
G
E
F
Z
1 12
12


Fixed submission (verdict: Accepted):
s = input ()
n = len (s)
for i in range (n):
  if s[i] == 'A':
    x = i
    break
for i in range (n):
  if s[-1-i] == 'Z':
    y = n-i-1
    break
print (y-x+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(input())

cnt = 0
on = False
result = []
for a in s:
    if a is 'A':
        on = True
    elif a is 'Z':
        result.append(cnt)
        cnt += 1
    if on:
        cnt += 1

print(max(result))

Failing test case input:
BGKAZFJAGOHI[GSFI

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
s = list(input())

cnt = 0
on = False
result = []
for a in s:
    if a is 'A':
        on = True
    if on:
        cnt += 1
    if a is 'Z':
        result.append(cnt)

print(max(result))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s)
ans = 0
for i in range(n):
    if s[i] == 'A':
        ans -= i
        break

for j in range(n-1, 0):
    if s[j] == 'Z':
        ans += j
        break

print(ans)


Failing test case input:
SCAG[IHNGFKKZIFGB

Expected output:
11


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()
n = len(s)
ans = 0
for i in range(n):
    if s[i] == 'A':
        ans -= i

        break

for j in reversed(range(0, n)):
    if s[j] == 'Z':
        ans += j
        break

print(ans + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()

Aindex = s.find("A")
Zindex = -1

for index,character in enumerate(s[Aindex:]):
    if character == "Z":
        Zindex = index

print(s[Aindex:Zindex+1])

Failing test case input:
HASHJGFOGAKZZFEIA

Expected output:
12


Actual output:
ASHJGFOGAKZ


Fixed submission (verdict: Accepted):
s=input()
Aindex = s.find("A")
Zindex = -1
for index,character in enumerate(s[Aindex:]):
    if character == "Z":
        Zindex = index + Aindex
print(len(s[Aindex:Zindex+1]))
Problem: p03814
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
din = str(input())
length = len(din)
first_A = -1
last_Z = -1
for i in range(length):
    if (din[i] == 'A' and first_A == -1):
        location_A = i
    elif din[i] == 'Z':
        last_Z = i
print(last_Z-first_A+1)

Failing test case input:
SCAG[IHNGFKKZIFGB

Expected output:
11


Actual output:
14


Fixed submission (verdict: Accepted):
din = str(input())
length = len(din)
first_A = -1
last_Z = -1
for i in range(length):
    if (din[i] == 'A' and first_A == -1):
        first_A = i
    elif din[i] == 'Z':
        last_Z = i
print(last_Z-first_A+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
Strings = input()

for i in range(0,len(Strings)):
    if Strings[i] == "A":
        length = i
        print(i)
        break

for i in range(len(Strings))[::-1]:
    if Strings[i] == "Z":
        length2 = i
        print(i)
        break

print(length2 - length +1 )

Failing test case input:
HASF[HHNG@KJZFEGA

Expected output:
12


Actual output:
1
12
12


Fixed submission (verdict: Accepted):
Strings = input()

for i in range(0,len(Strings)):
    if Strings[i] == "A":
        length = i
        break

for i in range(len(Strings))[::-1]:
    if Strings[i] == "Z":
        length2 = i
        break

print(length2 - length +1 )

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
print(s[1:-1])
r_s = s[::-1]

if r_s.index("Z")==0:
    print(len(s[s.index("A"):]))
else:
    print(len(s[s.index("A"):-r_s.index("Z")]))

Failing test case input:
HBSGJGGOGAK[ZFEIA

Expected output:
4


Actual output:
BSGJGGOGAK[ZFEI
4


Fixed submission (verdict: Accepted):
s = input()
r_s = s[::-1]

if r_s.index("Z")==0:
    print(len(s[s.index("A"):]))
else:
    print(len(s[s.index("A"):-r_s.index("Z")]))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
sa = 0
sz = 0
for i in range(len(s)):
    if sa == 0 and s[i] == "A":
        sa = i
    if s[i] == "Z":
        sz = i
print(sz-sa+1)

Failing test case input:
AGEFZJG@GNHHZFSAK

Expected output:
13


Actual output:
-2


Fixed submission (verdict: Accepted):
s = input()
a = -1
z = -1
for i in range(len(s)):
    if a == -1 and s[i] == "A":
        a = i
    if z == -1 and s[-1-i] == "Z":
        z = i
print(len(s)-a-z)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
L = len(S)
for i in range(L):
  c = S[i]
  if c == "A":
    s = i
    break
for i in range(L):
  c = S[-(i+1)]
  if c == "Z":
    e = L - (i+1)
    break
print(S[s:e+1])


Failing test case input:
HBSG[OHIGAKKZFEGB

Expected output:
4


Actual output:
AKKZ


Fixed submission (verdict: Accepted):
S = input()
L = len(S)
for i in range(L):
  c = S[i]
  if c == "A":
    s = i
    break
for i in range(L):
  c = S[-(i+1)]
  if c == "Z":
    e = L - (i+1)
    break
print(e-s+1)
Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=[x for x in input()]
T=S[::-1]
start=0
end=0
for i in range(len(S)):
  if S[i]=='A':
    start=i
    break
for i in range(len(T)):
  if T[i]=='Z':
    end=i
    break
    
print(end-start+1)

Failing test case input:
IASG[IHOGFKFZAKGB

Expected output:
12


Actual output:
4


Fixed submission (verdict: Accepted):
S=[x for x in input()]
T=S[::-1]
start=0
end=0
for i in range(len(S)):
  if S[i]=='A':
    start=i
    break
for i in range(len(T)):
  if T[i]=='Z':
    end=i
    break
    
print(len(S)-end-start)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
i, j = 0, len(s)-1
while(1):
    if s[i] == "A":
        start = i
        break
    i += 1
while(1):
    if s[j] == "Z":
        end = j + 1
        break
    j -= 1
print(end - start +1)

Failing test case input:
HASG[OHIGAKKZFEGB

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
s = input()
i, j = 0, len(s)-1
while(1):
    if s[i] == "A":
        start = i
        break
    i += 1
while(1):
    if s[j] == "Z":
        end = j + 1
        break
    j -= 1
print(end - start)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s)

x = []

for i in range(n):
    if 'A' not in x and s[i] is 'A':
        x.append(i)
        x.append('A')
    elif 'A' in x and s[i] is 'Z':
        x.append(i)

print(x)
print(x[-1] - x[0] + 1)


Failing test case input:
IBAH[GHOGFKKZSFIA

Expected output:
11


Actual output:
[2, 'A', 12]
11


Fixed submission (verdict: Accepted):
s = input()
n = len(s)

x = []

for i in range(n):
    if 'A' not in x and s[i] is 'A':
        x.append(i)
        x.append('A')
    elif 'A' in x and s[i] is 'Z':
        x.append(i)

print(x[-1] - x[0] + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input()
b = ""
counterf=0
counter =0

for x in a:
    if x == "A":
        b+=x
        counterf +=1
    elif counterf ==1:
        b+=x
        if x == "Z":
            break
    counter+=1
print(len(b))
    

Failing test case input:
HASF[IHOGAKKZFEGA

Expected output:
12


Actual output:
10


Fixed submission (verdict: Accepted):
a = input()
b = ""
c=""
counterf=0
counter =0


for x in a:
    if x == "A":
        b+=x
        counterf +=1
    elif counterf >=1:
        b+=x
        
for x in b[::-1]:
    if x == "Z":
        c+=x
        counter+=1
    elif counter >=1:
        c+=x
print(len(c))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
N = len(S)
for i in range(N):
    if S[i] == 'A':
        a_index = i
        break
for i in range(N-1,0,-1):
    if S[i] == 'Z':
        z_index = i
        break

print(N - z_index - a_index)


Failing test case input:
ICAF[IFNGFKKZSHGB

Expected output:
11


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
N = len(S)
for i in range(N):
    if S[i] == 'A':
        a_index = i
        break
S=S[::-1]
for i in range(N):
    if S[i] == 'Z':
        z_index = i
        break

print(N - z_index - a_index)
Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
a=0
z=0

for i in range(len(s)):
    if s[i]=="A":
        a = i
        break

for i in range(len(s)):
    if s[-i-1]=="Z":
        z = len(s)-i-1

print(z-a+1)

Failing test case input:
AGEFZJG@GNHHZFSAK

Expected output:
13


Actual output:
5


Fixed submission (verdict: Accepted):
s = input()
a=0
z=0

for i in range(len(s)):
    if s[i]=="A":
        a = i
        break

for j in range(len(s)):
    if s[-j-1]=="Z":
        z = len(s)-j-1
        break

print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):




s = input()
list_s = list(s)

test = True

def length_AZ(l):
    
    len_l = len(l)
    index_A = []
    index_Z = []

    for i in range(len_l):
        if l[i] == 'A':
            index_A.append(i)
        elif l[i] == 'Z':
            index_Z.append(i)

    if test:
        print('index_A =', index_A)
        print('index_Z =', index_Z)

    return max(index_Z) - min(index_A) + 1


def main():
    
    print(length_AZ(list_s))


if __name__ == '__main__':
    main()


Failing test case input:
AGEFZJK@GNHH[FSAG

Expected output:
5


Actual output:
index_A = [0, 15]
index_Z = [4]
5


Fixed submission (verdict: Accepted):




s = input()
list_s = list(s)

test = False

def length_AZ(l):
    
    len_l = len(l)
    index_A = []
    index_Z = []

    for i in range(len_l):
        if l[i] == 'A':
            index_A.append(i)
        elif l[i] == 'Z':
            index_Z.append(i)

    if test:
        print('index_A =', index_A)
        print('index_Z =', index_Z)

    return max(index_Z) - min(index_A) + 1


def main():
    
    print(length_AZ(list_s))


if __name__ == '__main__':
    main()

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

ans_a = s.index("A")
ans_z = s.index("Z")

print(ans_z - ans_a + 1)

Failing test case input:
HASHJGFOGAKZZFEHA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()

ans_a = s.index("A")
ans_z = s.rfind("Z")

print(ans_z - ans_a + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

CA = s.index('A')
CZ = s.rindex('Z') 
L = len(s)

print(L-CA-CZ+2)

Failing test case input:
IARF[IHPGAKKZFEGA

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
s = input()

CA = s.index('A')
CZ = s.rindex('Z') 


print(CZ-CA+1)

Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
S = input()
A_index = None
Z_index = None
for i in  range(len(S)):
    if S[i] == "A":
        A_index = i
    elif S[i] == "Z":
        Z_index = i
print(len(S[A_index:Z_index+1]))

Failing test case input:
AGDFZKKAGOHH[FSAH

Expected output:
5


Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
A_index = []
Z_index = None
for i in  range(len(S)):
    if S[i] == "A":
        A_index.append(i)
    elif S[i] == "Z":
        Z_index = i
print(len(S[A_index[0]:Z_index+1]))
Problem: p03814
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input()
start = end = 0
for i in range(len(s)):
    if s[i] == 'A':
        start = i
for i in range(len(s)-1, -1, -1):
    if s[i] == 'Z':
        end = i + 1
print(end - start)

Failing test case input:
IAAG[HHOGFKKZSFGB

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()
start = 0
end = 0
for i in range(len(s)):
    if s[i] == 'A':
        start = i
        break
for i in range(len(s)-1, 0, -1):
    if s[i] == 'Z':
        end = i + 1
        break
print(end - start)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a_index = 0
z_index = 0

for i in range(0, len(s)):
    if s[i] == "A":
        a_index = i
        break
        
for i in range(0, len(s)):
    if s[len(s)-i-1] == "Z":
        z_index = len(s)-i
        break
print(z_index - a_index + 1)


Failing test case input:
GASF[HHNG@KJZFEGA

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
s = input()
a_index = 0
z_index = 0

for i in range(0, len(s)):
    if s[i] == "A":
        a_index = i
        break
        
for i in range(0, len(s)):
    if s[len(s)-i-1] == "Z":
        z_index = len(s)-i-1
        break
print(z_index - a_index +1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = []
s = input()
min_a = 0
max_z = 0
for i in range(len(s)):
  if s[i]=='A' and min_a==0:
    min_a = i
  elif s[i]=='Z':
    max_z = i
 
print(max_z-min_a+1)
  

Failing test case input:
AGEFZJG@GNHHZFSAK

Expected output:
13


Actual output:
-2


Fixed submission (verdict: Accepted):
s = []
s = input()
min_a = -1
max_z = 0
for i in range(len(s)):
  if s[i]=='A' and min_a==-1:
    min_a = i
  elif s[i]=='Z':
    max_z = i
 
print(max_z-min_a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
a = 0
z = 0
for i in range(len(s)):
    if s[i] == 'A' and a == 0:
        a = i 
    if s[i] == 'Z':
        z = i 
ans = z - a + 1
print(ans)



Failing test case input:
AGEFZJK@GNHH[FSAG

Expected output:
5


Actual output:
-10


Fixed submission (verdict: Accepted):
s = input()
a = 0
z = 0
for i in range(len(s)):
    if s[i] == 'A' and a == 0:
        a = i + 1
    if s[i] == 'Z':
        z = i 
ans = z - a + 2
print(ans)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
row = input().split()
s = list(row[0])
Flag = 0
count = 0
for i in range(len(s)):
    if s[i] == 'A':
        Flag = 1
    if s[i] == 'Z':
        Flag = 0

    if Flag == 1:
        count += 1

print(count+1)


Failing test case input:
HASF\IHOGBKJZFEFA

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
row = input().split()
s = list(row[0])
Flag = 0
count = 0
ans = 0
for i in range(len(s)):
    if s[i] == 'A':
        Flag = 1
    if s[i] == 'Z' and Flag == 1:
        ans = count

    if Flag == 1:
        count += 1

print(ans+1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
S = input()
print(len(S[S.index("A"):S.index("Z")+1]))

Failing test case input:
HASGZIIZGAKKOFEGA

Expected output:
7


Actual output:
4


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
s = input()
print(len(s)-s[::-1].index("Z")-s.index("A"))

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

a = s.index('A')
for i in range(len(s)):
  if s[-i] == 'Z':
    z = len(s) - i
    break

print(z - a + 1)

Failing test case input:
ZABCZ

Expected output:
4

Actual output:
5


Fixed submission (verdict: Accepted):
s = input()

a = s.index('A')
z = []
for i in range(len(s)):
  if s[i] == 'Z':
    z.append(i)
    
print(max(z) - a + 1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
ans=0
tmp=0
end=0
for i in range(len(S)):
	if S[i]=="A":
		tmp=i
		break
for i in range(1,len(S)):
	if S[-i]=="Z":
		end=len(S)-i
		break
print(tmp,end)
print(end-tmp+1)

Failing test case input:
HASF\IHOGAKJZFEGA

Expected output:
12


Actual output:
1 12
12


Fixed submission (verdict: Accepted):
S=input()
ans=0
tmp=0
end=0
for i in range(len(S)):
	if S[i]=="A":
		tmp=i
		break
for i in range(1,len(S)):
	if S[-i]=="Z":
		end=len(S)-i
		break
print(end-tmp+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
a=s.index("A")
z=0
for i in range(len(s)):
    if s[-i]=="Z":
        print((len(s)-a-i+1))
        break

Failing test case input:
ZAACZ

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
s=input()
a=s.index("A")
z=0
for i in range(1,len(s)):
    if s[-i]=="Z":
        print((len(s)-a-i+1))
        break

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
for a in range(len(s)):
  if s[a]=='A':
    break
s = s[::-1]
for z in range(len(s)):
  if s[z] =='Z':
    break
s= s[::-1]
print(s[a:-z+1])

Failing test case input:
HASH[GFOGAKJZFEGA

Expected output:
12


Actual output:
ASH[GFOGAKJZF


Fixed submission (verdict: Accepted):
s = input()
for a in range(len(s)):
  if s[a]=='A':
    break
s = s[::-1]
for z in range(len(s)):
  if s[z] =='Z':
    break
print(len(s)-z-a)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

a = s.index('A')
for i in range(len(s)):
  if s[-i] == 'Z':
    z = len(s) - i

print(z - a + 1)

Failing test case input:
HASHJGFOGAKZZFEIA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = input()

a = s.index('A')
z = []
for i in range(len(s)):
  if s[i] == 'Z':
    z.append(i)
    
print(max(z) - a + 1)
Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

st = 0
ed = 0
for i in range(len(s)):
  if s[i] == "A":
    st = i
    break
for i in range(len(s)):
  if s[-i] == "Z":
    ed = -i + len(s)
    break
print(ed-st)

Failing test case input:
HBSG[OHIGAKKZFEGB

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
s = input()
s = s

st = 0
ed = 0
for i in range(len(s)):
  if s[i] == "A":
    st = i
    break
for i in range(len(s)):
  if s[-i + len(s) -1] == "Z":
    ed = -i + len(s) - 1
    break
print(ed-st+1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
len = len(S)
start = len
end = 0
for i in range(len):
  if(S[i] == "A"):
    temp_start = i+1
    start = min(start,temp_start)
  if(S[i] == "Z"):
    temp_end = i+1
    end = max(end,temp_end)
print(end-start)

Failing test case input:
HARF[IHOGAKKZFEGA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
S = input()
len = len(S)
start = len
end = 0
for i in range(len):
  if(S[i] == "A"):
    temp_start = i+1
    start = min(start,temp_start)
  if(S[i] == "Z"):
    temp_end = i+1
    end = max(end,temp_end)
print(end-start+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
a = S.index("A")
z = S.index("Z")
print(z - a + 1)

Failing test case input:
ZABCZ

Expected output:
4

Actual output:
0


Fixed submission (verdict: Accepted):
S = input()
A = S.find("A")
Z = S.rfind("Z")
print(Z - A + 1)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=input()
for i in range(len(a)):
  if a[i]=="A":
    b=i
    break
for i in range(len(a)):
  if a[len(a)-i-1]:
    c=i
    break
print(c-b)

Failing test case input:
IBAH[GHNGFKKZSFIA

Expected output:
11


Actual output:
-2


Fixed submission (verdict: Accepted):
a=input()
for i in range(len(a)):
  if a[i]=="A":
    b=i
    break
for k in range(len(a)):
  if a[-k-1]=="Z":
    c=k
    break
print(len(a)-c-b)

Problem: p03814
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = list(input())

for i in s:
    if i == 'A':
        a = s.index(i)
        break
for i in s:
    if i == 'Z':
        z = s.index(i)
print(z-a+1)

Failing test case input:
HASHJGFOGAKZZFEHA

Expected output:
12


Actual output:
11


Fixed submission (verdict: Accepted):
s = list(input())

for i,j in enumerate(s):
    if j == 'A':
        a = i
        break
for i,j in enumerate(s):
    if j == 'Z':
        z = i
print(z-a+1)

Problem: p03814
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=list(input())
x=s.index('A')
t=sorted(s)
y=t.index('Z')
print(len(s)-x-y)

Failing test case input:
BZACZ

Expected output:
3


Actual output:
0


Fixed submission (verdict: Accepted):
s=list(input())
x=s.index('A')
t=list(reversed(s))
y=t.index('Z')
print(len(s)-x-y)