qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
x=input()
if (x[0:1]=='A' ) :
    pass
else:
    print('WA')
    exit

if 'C' in x[2:len(x)-1]:
    pass
else:
    print('WA')
    exit

y=x.replace('C','c')
y=y.replace('A','a')

if str.islower(y):
    print('AC')
else:
    print('WA')
        

Fixed code:
x=input()
import sys

if (x[0:1]=='A') :
    pass
else:
    print('WA')
    sys.exit()

if 'C' in x[2:len(x)-1]:
    pass
else:
    print('WA')
    sys.exit()

z=x[2:len(x)-1]
    
if z.count('C')==1:
    pass
else:
    print('WA')
    sys.exit()

y=x.replace('C','c')
y=y.replace('A','a')


if str.islower(y):
    print('AC')
else:
    print('WA')
Buggy code:
S = input()
if S[0]!='A':
  print('WA')
else:
  i = 2
  count = 0
  while i < len(S):
  	if S[i] == 'C':
      		count += 1
  	i += 1
  if count != 1:
    print('WA')
  S = S.replace('A','').replace('C','')
  if S.islower() == False:
    print('WA')
  else:
    print('AC')

Fixed code:
S = input()
if S[0]!='A':
  print('WA')
else:
  i = 2
  count = 0
  while i < len(S)-1:
  	if S[i] == 'C':
      		count += 1
  	i += 1
  if count != 1:
    print('WA')
  else:
    S = S.replace('A','').replace('C','')
    if S.islower() == False:
      print('WA')
    else:
      print('AC')
Buggy code:
S = input()

a = S[0] == 'A'
b = S[2:-2].count('C') == 1
if a and b:
    S = list(S)
    print(S)
    print(S[-1])
    S_1 = S[2:-2]
    S_1.remove('C')
    S = S[0:2] + S_1 + S[-2:]
    del S[0]
    print(S)
    c = str(S).islower()

if a and b and c:
    print('AC')
else:
    print('WA')


Fixed code:
S = input()

a = S[0] == 'A'
b = S[2:-1].count('C') == 1
if a and b:
    S = list(S)
    S_1 = S[2:-1]
    S_1.remove('C')
#    print(S[0:2])
#    print(S_1)
#    print(S[-1:])
    S = S[0:2] + S_1 + S[-1:]
    del S[0]
#    print(S)
    c = str(S).islower()

if a and b and c:
    print('AC')
else:
    print('WA')
Buggy code:
s = input()

cnt = 0
for c in s:
    if c.isupper() and c == "A":
        cnt = cnt + 1

if cnt != 2:
    print("WA")
    exit()

if not s[0].isupper():
    print("WA")
    exit()

if s[2:len(s)-1].count("C") == 1:
    print("AC")
else:
    print("WA")

Fixed code:
s = input()

cnt = 0
for c in s:
    if c.isupper():
        cnt = cnt + 1

if cnt != 2:
    print("WA")
    exit()

if not s[0] == "A":
    print("WA")
    exit()

if s[2:len(s)-1].count("C") == 1:
    print("AC")
else:
    print("WA")
Buggy code:
S = list(input())

if S[0] == "A":
    S2 = S[2:-1]
    count = S2.count("C")

    if count == 1:
        S.remove("A")
        S.remove("C")

        count2 = 0
        for i in range(len(S)):
           if S[i].islower():
               count2 += 1
               
        if count2 == len(S):
                   print("AC")

        else:
            print("WA")

Fixed code:
S = list(input())
if S[0] == "A" and S[2:-1].count("C") == 1:
    S.remove("A")
    S.remove("C")
    count = 0
    for i in range(len(S)):
        if S[i].islower():
            count += 1
    if count == len(S):
        print("AC")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
s = input()
ans = True
if s[0]!='A':
  ans = False
if s[2:-1].count('C')!=1:
  ans = False
upper = 0
for i in  s:
  if i.isupper:
    upper += 1
if upper != 2:
  ans = False
if ans:
  print('AC')
else:
  print('WA')

Fixed code:
s = input()
ans = True
if s[0]!='A':
    ans = False
if s[2:-1].count('C')!=1:
    ans = False
upper = 0
for i in  s:
    if i.isupper():
        upper += 1

if upper != 2:
    ans = False

if ans:
    print('AC')
else:
    print('WA')
Buggy code:
s=input()
if s[0] != 'A':
    print('WA')
    exit()
if s[2:-2].count('C') != 1:
    print('WA')
    exit()
for i in range(1,len(s)):
    if s[i]=='C':
        continue
    if s[i].isupper() == True:
        print('WA')
        exit()
print('AC')

Fixed code:
s=input()
cnt=0
if s[0] != 'A':
    print('WA')
    exit()
if s[2:len(s)-1].count('C') != 1:
    print('WA')
    exit()
else:
    for i in range(1,len(s)):
        if s[i]=='C':
            continue
        if s[i].isupper():
            print('WA')
            exit()

print('AC')
Buggy code:
import string

alp = string.ascii_uppercase

def main():
    S = input()
    len_s = len(S)

    if S[0] != 'A':
        print ('WA')
        return

    for i in range(1, len_s-1):
        if S[i] == 'C':
            c_index = i
            break
        if i == len_s-2:
            print ('WA')
            return

    for i in range(2, len_s):
        if i == c_index:
            continue
        if S[i] in alp:
            print ('WA')
            return

    print ('AC')

main()


Fixed code:
import string

alp = string.ascii_uppercase

def main():
    S = input()
    len_s = len(S)

    if S[0] != 'A':
        print ('WA')
        return

    for i in range(2, len_s-1):
        if S[i] == 'C':
            c_index = i
            break
        if i == len_s-2:
            print ('WA')
            return

    for i in range(1, len_s):
        if i == c_index:
            continue
        if S[i] in alp:
            print ('WA')
            return

    print ('AC')

main()
Buggy code:
S = list(input())

print(S[2:-1])
if S[0] == "A":
    if S[2:-1].count("C") == 1:
        idx = S.index("C")
        for i, s in enumerate(S):
            if s.isupper():
                if (i == 0) or (i == idx):
                    continue
                else:
                    print("WA")
                    exit()
        print("AC")
        exit()
print("WA")


Fixed code:
S = list(input())

if S[0] == "A":
    if S[2:-1].count("C") == 1:
        idx = S.index("C")
        for i, s in enumerate(S):
            if s.isupper():
                if (i == 0) or (i == idx):
                    continue
                else:
                    print("WA")
                    exit()
        print("AC")
        exit()
print("WA")
Buggy code:
S = input()
print("AC" if S[0] == "A" and S[3:-2].count("C") ==
      1 and S[1:].replace("C", "", 1).islower() else "WA")


Fixed code:
S = input()
print("AC" if S[0] == "A" and S[2:-1].count("C") ==
      1 and S[1:].replace("C", "", 1).islower() else "WA")
Buggy code:
import re
S = input().strip()
print('AC' if re.match(r'^A[a-z]*C[a-z]*$', S) else 'WA')

Fixed code:
import re
S = input().strip()
print('AC' if re.match(r'^A[a-z]+C[a-z]+$', S) else 'WA')
Buggy code:
import re

s = input()
reg = re.match('[A][a-z]+[C][a-z]+', s)
if reg:
    print('AC')
else:
    print('WA')


Fixed code:
import re

s = input()
reg = re.match('[A][a-z]+[C][a-z]+$', s)
if reg:
    print('AC')
else:
    print('WA')
Buggy code:
S = list(input())

if S[0] != 'A':
    print('WC')
elif S[2:-1].count('C') != 1:
    print('WC')
else:
    S = list(S[1:])
    S.remove('C')
    S = ''.join(S)
    if S.islower():
        print('AC')
    else:
        print('WC')


Fixed code:
S = list(input())

if S[0] != 'A':
    print('WA')
elif S[2:-1].count('C') != 1:
    print('WA')
else:
    S = list(S[1:])
    S.remove('C')
    S = ''.join(S)
    if S.islower():
        print('AC')
    else:
        print('WA')
Buggy code:
S = list(input())
A_check = []
C_check = []
lower_check = []

for i in range(len(S)):
    if S[i] == 'A':
        A_check.append(i)
    
    if S[i] == 'C':
        C_check.append(i)
    
    if S[i].islower():
        lower_check.append(i)
        

if len(A_check) != 1 or len(C_check) != 1 or len(lower_check) != (len(S) - 2):
    print('WA')
elif A_check[0] != '0' or C_check[0] == len(S) - 1 or C_check[0] < 2:
    print('WA')
else:
    print('AC')


Fixed code:
S = list(input())
A_check = []
C_check = []
lower_check = []

for i in range(len(S)):
    if S[i] == 'A':
        A_check.append(i)
    
    if S[i] == 'C':
        C_check.append(i)
    
    if S[i].islower():
        lower_check.append(i)
        

if len(A_check) != 1 or len(C_check) != 1 or len(lower_check) != (len(S) - 2):
    print('WA')
elif A_check[0] != 0 or C_check[0] == len(S) - 1 or C_check[0] < 2:
    print('WA')
else:
    print('AC')
Buggy code:
S = input ()
T = S.replace('A', '')
T = T.replace('C', '')
U = T.lower ()
if S[0]=='A' and S[2:-2].count('C')==1 and T==U:
  print ('AC')
else:
  print ('WA')

Fixed code:
S = input ()
T = S.replace('A', '')
T = T.replace('C', '')
U = T.lower ()
if S[0]=='A' and S.count('A')==1 and S[2:-1].count('C')==1 and S.count('C')==1 and T==U:
  print ('AC')
else:
  print ('WA')
Buggy code:
s=input()
yn=0
if s[0]=="A" and ord(s[2])>95 and ord(s[len(s)-1])>95 and s.count("C")==1:
    for i in range(len(s)-3):
        if s[i+2]!="C" and ord(s[i+2])<92:
            yn=1
    if yn==1:
        print("WA")
    else:
        print("AC")
else:
    print("WA")


Fixed code:
s=input()
yn=0
if s[0]=="A" and ord(s[1])>95 and ord(s[len(s)-1])>95 and s.count("C")==1:
    for i in range(len(s)-3):
        if s[i+2]!="C" and ord(s[i+2])<92:
            yn=1
    if yn==1:
        print("WA")
    else:
        print("AC")
else:
    print("WA")
Buggy code:
S = input()
n = len(S)
p = 0
if S[0] == 'A':
    p = 1
s = []
for i in range(2,n-1):
    s.append(S[i])
q = 0
if s.count('C') == 1:
    q = 1
s.remove('C')
s.append(S[1])
s.append(S[n-1])
r = 1
for i in range(n-2):
    x = s[i]
    t = ord(x)-97
    if 0<= t <= 25:
        continue
    else:
        r = 0
        break
ans = 'WA'
if p*q*r == 1:
    ans = 'AC'
print(ans)

Fixed code:
S = input()
n = len(S)
p = 0
if S[0] == 'A':
    p = 1
s = []
for i in range(2,n-1):
    s.append(S[i])
q = 0
if s.count('C') == 1:
    q = 1
if 'C' in s:
    s.remove('C')
s.append(S[1])
s.append(S[n-1])
r = 1
for i in range(n-2):
    x = s[i]
    t = ord(x)-97
    if 0<= t <= 25:
        continue
    else:
        r = 0
        break
ans = 'WA'
if p*q*r == 1:
    ans = 'AC'
print(ans)
Buggy code:
s = list(input())
count = 0

if s[0] == "A":
    for i in range(2,len(s)-1):
        if s[i] == "C":
            count += 1
    if count != 1:
        print("WA")
        exit()
    else:
        number = s.index("C")
else:
    print("WA")
    exit()

s.remove(0)
s.remove(number)

for j in s:
    c = j.lower()
    if c == j:
        continue
    else:
        print("WA")
        exit()
print("AC")


Fixed code:
s = list(input())
count = 0

if s[0] == "A":
    for i in range(2,len(s)-1):
        if s[i] == "C":
            count += 1
    if count != 1:
        print("WA")
        exit()
    else:
        number = s.index("C")
else:
    print("WA")
    exit()

del s[number]
del s[0]

for j in s:
    c = j.lower()
    if c == j:
        continue
    else:
        print("WA")
        exit()
print("AC")
Buggy code:
word = input('')

ans = 'WA'


if  (word[0] == 'A'):
    tmp = word[2:-1]
    number_c = 0
    for i in range(len(tmp)):
        if  tmp[i] == 'C':
            number_c += 1
            serial_c = i+2        
    if  number_c == 1:
        word_del = word[0:serial_c-1] + word[serial_c:]
        word_del = word_del[1:]
        
        if  word_del.islower():
            ans = 'AC'
print(ans)

Fixed code:
word = input('')

ans = 'WA'

if  (word[0] == 'A'):
    tmp = word[2:-1]
    number_c = 0
    for i in range(len(tmp)):
        if  tmp[i] == 'C':
            number_c += 1
            serial_c = i+2
    if  number_c == 1:
        word_del = word[0:serial_c] + word[serial_c+1:]
        word_del = word_del[1:]
        
        if  word_del.islower():
            ans = 'AC'
print(ans)
Buggy code:
# -*- coding: utf-8 -*-

S = input()

if S[0] == 'A':
    if S[2:-2].count('C') == 1:
        tmp = S[1:].replace('C', '')
        if tmp.islower() or tmp.isupper():
            print('AC')
            exit()

print('WA')


Fixed code:
# -*- coding: utf-8 -*-

S = input()

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        tmp = S[1:].replace('C', '')
        if tmp.islower() or tmp.isupper():
            print('AC')
            exit()

print('WA')
Buggy code:
s = input()
if s[0] == 'A':
    s = s[1:]
    if s[1:-2].count('C') == 1:
        for char in s:
            if char != 'C' and char == char.upper():
                break
        else:
            print('AC')
            exit()
print('WA')


Fixed code:
s = input()
if s[0] == 'A':
    s = s[1:]
    if s[1:-1].count('C') == 1:
        for char in s:
            if char != 'C' and char == char.upper():
                break
        else:
            print('AC')
            exit()
print('WA')
Buggy code:
import re;print("AC"if re.match("A[a-z]+C[a-z]+",input())else"WA")

Fixed code:
import re;print("AC"if re.match("^A[a-z]+C[a-z]+$",input())else"WA")
Buggy code:
import re
print("AC") if re.match(r"^A[a-z]+C[a-z]+",input()) else print("WA")

Fixed code:
import re;print("AC") if re.match(r"^A[a-z]+C[a-z]+$",input()) else print("WA")
Buggy code:
s = input()
if s[0] != 'A':
  print('WA')
  exit()
sho = ord('a')
ok = 0
for i in s[2: len(s) - 1]:
  if ord(i) < sho:
    if ord(i) == ord("C"):
      ok += 1
    else:
      print("WA")
      exit()
if ord(s[0]) < sho or ord(s[1]) < sho or ord(s[len(s) - 1]) < sho:
  print("WA")
  exit()
if ok == 1:
  print("AC")
else:
  print("WA")

Fixed code:
s = input()
if s[0] != 'A':
  print('WA')
  exit()
sho = ord('a')
ok = 0
for i in s[2: len(s) - 1]:
  if ord(i) < sho:
    if ord(i) == ord("C"):
      ok += 1
    else:
      print("WA")
      exit()
if ord(s[1]) < sho or ord(s[len(s) - 1]) < sho:
  print("WA")
  exit()
if ok == 1:
  print("AC")
else:
  print("WA")
Buggy code:
s = input()
if s[0] == 'A' and s[2,-1].count('C') == 1 and s[1:].replace('C').islower():
    print('AC')
else:
    print('WA')

Fixed code:
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and s[1:].replace('C','').islower():
    print('AC')
else:
    print('WA')
Buggy code:
import sys
input = sys.stdin.readline

s = list(input())



if s[0] != 'A':
    print('WA')
    exit()

cnt = 0

for i in range(2, len(s)-1):
    if s[i]=='C':
        index = i
        cnt += 1


if cnt != 1 or cnt == 0:
    print('WA')
    exit()

del(s[0])
del(s[i])

s = ''.join(s)
if s.islower:
    print('AC')
else:
    print('WA')

Fixed code:
import sys
input = sys.stdin.readline

s = list(input())



if s[0] != 'A':
    print('WA')
    exit()

cnt = 0

for i in range(2, len(s)-2):
    if s[i]=='C':
        index = i
        cnt += 1


if cnt != 1:
    print('WA')
    exit()



del(s[index])
del(s[0])


s = ''.join(s)

if s.islower():
    print('AC')
else:
    print('WA')
Buggy code:
S = input()
if S[0] == 'A' and S[2:-2].count('C') == 1 and S[1] != 'C' and S[-1] != 'C' and S[1:].replace('C','').islower():
  print('AC')
else:
  print('WA')

Fixed code:
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1 and S[1] != 'C' and S[-1] != 'C' and S[1:].replace('C','').islower():
  print('AC')
else:
  print('WA')
Buggy code:
s=input()
for c in s:
	if (not ('a'<=c and c<='z')) and (not(c=='A' or c=='C')):
		print("WA")
		exit(0)
if s[0]!='A':
	print("WA2")
	exit(0)
if s[2:len(s)-1].count('C')!=1:
	print("WA3")
	exit(0)
print("AC")


Fixed code:
s=input()
for c in s:
	if (not ('a'<=c and c<='z')) and (not(c=='A' or c=='C')):
		print("WA")
		exit(0)
if s[0]!='A':
	print("WA")
	exit(0)
if s[2:len(s)-1].count('C')!=1:
	print("WA")
	exit(0)
print("AC")
Buggy code:
s = list(input())

if s[0]!="A":
  print("WA")
  exit()

frag = True
for i in range(2,len(s)-2):
  if s[i]=='C':
    frag = False
    del s[i]

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")

Fixed code:
s = list(input())

if s[0]!="A":
  print("WA")
  exit()

frag = True
for i in range(2,len(s)-1):
  if s[i]=='C':
    frag = False
    del s[i]
    break

if frag:
  print("WA")
  exit()
  
if not "".join(s[1:]).islower():
  print("WA")
else:
  print("AC")
Buggy code:
import copy
s=list(input())
if s[0]=='A' and 'C' in s[2:len(s)] :
  t=copy.copy(s)
  s.remove('A')
  s.remove('C')
  result=''.join(s)
  if len(s)==len(t)-2 and result.islower==True:
    print('AC')
  else:
    print('WA')
    
else:
  print('WA')

Fixed code:
import copy
s=list(input())
if s[0]=='A' and 'C' in s[2:len(s)] :
  t=copy.copy(s)
  s.remove('A')
  s.remove('C')
  result=''.join(s)
  if len(s)==len(t)-2 and result.islower()==True and t[-1]!='C':
    print('AC')
  else:
    print('WA')
    
else:
  print('WA')
Buggy code:
s = input()
if s[0]!='A' or s[2:-1].count('C')!= 1:
  print('WA')
  exit()
  
for c in s[1:]:
  if not('a'<= c <= 'z') or c=='C':
    print('WA')
    break
else:
  print('AC')

Fixed code:
s = input()
if s[0]!='A' or s[2:-1].count('C')!= 1:
  print('WA')
  exit()
  
for c in s[1:]:
  if not(('a'<= c <= 'z') or  c=='C'):
    print('WA')
    break
else:
  print('AC')
Buggy code:
def is_upper_case(s):
  return not (ord('a') <= ord(s) <= ord('z'))

S = input()

if S[0] != 'A':
  print("WA")
  exit()

if S[2:-1].count('C') != 1:
  print("WA")
  exit()

upper_num = map(is_upper_case, S).count(True)

if upper_num != 2: # expected only 'A', 'C'
  print("WA")
  exit()

print("AC")


Fixed code:
def is_upper_case(s):
  return not (ord('a') <= ord(s) <= ord('z'))

S = input()

if S[0] != 'A':
  print("WA")
  exit()

if S[2:-1].count('C') != 1:
  print("WA")
  exit()

upper_num = list(map(is_upper_case, S)).count(True)

if upper_num != 2: # expected only 'A', 'C'
  print("WA")
  exit()

print("AC")
Buggy code:
import sys
s = input()

l = len(s)
if s[0] != "A":
    print("WA")
    sys.exit()
ss =  s[2:l-1]
if ss.count("C") != 1:
    print("WA")
    sys.exit()

cidx = ss.find("C")+2
sss = s[1:cidx]+s[cidx+1:]
print(sss)
if sss.islower():
    print("AC")
    sys.exit()

print("WA")

Fixed code:
import sys
s = input()

l = len(s)
if s[0] != "A":
    print("WA")
    sys.exit()
ss =  s[2:l-1]
if ss.count("C") != 1:
    print("WA")
    sys.exit()

cidx = ss.find("C")+2
sss = s[1:cidx]+s[cidx+1:]
if sss.islower():
    print("AC")
    sys.exit()

print("WA")
Buggy code:
S = input()

ans = "WA"

if S[0] != "A":
  ans = "WA"
  print(ans)
else:
  if S[1:len(S) - 1].count("C") != 1:
    print(ans)
  else:
    s = S.index("C")
    SS = S[1:s] + S[s + 1:]
    if SS.islower() == False:
      print(ans)
    else:
      print("AC")

Fixed code:
S = input()

ans = "WA"

if S[0] != "A":
  print(ans)
  
else:
  if S[2:len(S) - 1].count("C") != 1:
    print(ans)
  else:
    s = S.index("C")
    SS = S[1:s] + S[s + 1:]
    if SS.islower() == False:
      print(ans)
    else:
      print("AC")
Buggy code:
S = input()
sl = []
ans = 'AC'

for i in S:
    sl.append(i)
if sl[0] != 'A':
    ans = 'WA'
if sl[2:-1].count('C') != 1:
    ans = 'WA'

if sl[1:].replace("C","c",1).islower() == False:
    ans = 'WA'
#print(sl)
print(ans)

Fixed code:
S = input()
sl = []
ans = 'AC'

for i in S:
    sl.append(i)
if S[0] != 'A':
    ans = 'WA'
if S[2:-1].count('C') != 1:
    ans = 'WA'

if S[1:].replace("C","c",1).islower() == False:
    ans = 'WA'
#print(sl)
print(ans)
Buggy code:
S = input()
if S[0] != 'A':
  print('WA')
elif S[2:-2].count('C') != 1:
  print('WA')
else:
  cindex = S.index('C')
  for i in range(len(S[1:])):
    if i == cindex:
      continue
    if S[i+1].isupper():
      print('WA')
      exit()
  print('AC')
    
    
     

Fixed code:
S = input()
if S[0] != 'A':
  print('WA')
elif S[2:-1].count('C') != 1:
  print('WA')
else:
  cindex = S.index('C')
  for i in range(len(S[1:])):
    if i+1 == cindex:
      continue
    if S[i+1].isupper():
      print('WA')
      exit()
  print('AC')
Buggy code:
S = input()

if S[0] == "A":
    if S.count("C") == 1:
        if S[2:-1].count("C") == 1:
            S = S.replace("A", "")
            S = S.replace("C", "")
            if S.islower():
                exit()

print("WA")


Fixed code:
S = input()

if S[0] == "A":
    if S.count("C") == 1:
        if S[2:-1].count("C") == 1:
            S = S.replace("A", "")
            S = S.replace("C", "")
            if S.islower():
                print("AC")
                exit()

print("WA")
Buggy code:


def solve():
    s = list(input())
    if s[0] == "A" and"C" in s[2:-1]:
        s.remove("A")
        s.remove("C")

        if "".join(s).islower:
            print("AC")
            exit()

    print("WA")


if __name__ == "__main__":
    solve()


Fixed code:


def solve():
    s = list(input())
    if s[0] == "A" and s[2:-1].count("C") == 1:
        s.remove("A")
        s.remove("C")

        if "".join(s).islower():
            print("AC")
            exit()

    print("WA")


if __name__ == "__main__":
    solve()
Buggy code:
s = list(input())

a = False
c = False
small = False
for i in range(len(s)):
    if i == 0 and s[i] == "A":
        a = True
    if a == True and i >= 2 and i < len(s) - 1 and s[i] == "C" and c == False:
        c = True
    elif s[i] >= "a" and s[i] <= "z":
        small = True
    else:
        small = False
        break

if a == True and c == True and small == True:
    print("AC")
else:
    print("WA")

Fixed code:
s = list(input())

a = False
c = False
small = False
for i in range(len(s)):
    if i == 0 and s[i] == "A":
        a = True
    elif a == True and i >= 2 and i < len(s) - 1 and s[i] == "C" and c == False:
        c = True
    elif s[i] >= "a" and s[i] <= "z":
        small = True
    else:
        small = False
        break

if a == True and c == True and small == True:
    print("AC")
else:
    print("WA")
Buggy code:
s = list(input())

a = [chr(i) for i in range(97, 97+26)]
A = [chr(i) for i in range(65, 65+26)]

flg = "AC"

if not s[0] == "A":
    flg = "WA"

if not s[2:-2].count("C") ==1:
    flg = "WA"

b = set(s)-set(["A","C"])

if not b<=set(a):
    flg = "WA"

print(flg)

Fixed code:
s = list(input())

a = [chr(i) for i in range(97, 97+26)]
A = [chr(i) for i in range(65, 65+26)]

flg = "AC"

if not s[0] == "A":
    flg = "WA"

if not s[2:-1].count("C") ==1:
    flg = "WA"

b = set(s)-set(["A","C"])

if not b<=set(a):
    flg = "WA"

print(flg)
Buggy code:
S = str(input())
if S[0] == "A":
    S = "a" + S[1:]
    print(S)
    if "C" in S[2:-1]:
        cs = False
        for i,s in enumerate(S[2:-1]):
            if not(cs) and s == "C":
                S = S[:i+2] + "c" + S[i+3:]
                print(S)
                cs = True
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Fixed code:
S = str(input())
if S[0] == "A":
    S = "a" + S[1:]
    if "C" in S[2:-1]:
        cs = False
        for i,s in enumerate(S[2:-1]):
            if not(cs) and s == "C":
                S = S[:i+2] + "c" + S[i+3:]
                cs = True
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
S = input()
if S[0] != 'A':
  print("WA")
else:
  if 'C' not in S[2:] or S[2:].count('C') > 1:
    print("WA")
  else:
    S[0:1].lower()
    i = S.find('C')
    S[i:i+1].lower()
    if S.islower():
      print("AC")
    else:
      print("WA")

Fixed code:
S = input()
if S[0] != 'A':
  print("WA")
else:
  if 'C' not in S[2:-1] or S[2:-1].count('C') > 1:
    print("WA")
  else:
    i = S.find('C')
    S = S[0:1].lower() + S[1:i] + S[i:i+1].lower() + S[i+1:]
    if S.islower():
      print("AC")
    else:
      print("WA")
Buggy code:
s = input()
l = len(s)

if s[0] == 'A':
  if s[3:l - 2].count('C') == 1:
    idx = s[3:l - 2].index('C') + 3
    if s[1:idx].islower() and s[idx + 1:].islower():
      print('AC')
      quit()
print('WA')

Fixed code:
s = input()
l = len(s)

if s[0] == 'A':
  if s[2:l - 1].count('C') == 1:
    idx = s[2:l - 1].index('C') + 2
    if s[1:idx].islower() and s[idx + 1:].islower():
      print('AC')
      quit()
print('WA')
Buggy code:
S = list(input())

if S[0] == 'A':
  isC = 0
  for i in S[2:len(S)]:
    if i == 'C':
      isC += 1
  else:
    if isC == 1:
      for i in range(len(S)):
        if S[i] == 'A' or S[i] =='C' or S[i].islower():
          pass
        else:
          print('WA')
          break
      else:
        print('AC')
    else:
      print('WA')
else:
  print('WA')

Fixed code:
S = list(input())

if S[0] == 'A':
  isC = 0
  for i in S[2:len(S)-1]:
    if i == 'C':
      isC += 1
  else:
    if isC == 1:
      for i in range(len(S)):
        if S[i] == 'A' or S[i] =='C' or S[i].islower():
          pass
        else:
          print('WA')
          break
      else:
        print('AC')
    else:
      print('WA')
else:
  print('WA')