qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import re
p = re.compile(r'A[a-z]{1,}C[a-z]{1,}')

S = input()
if bool(p.match(S)):
    print('AC')
else:
    print('WA')


Fixed code:
import re
p = re.compile(r'^A[a-z]{1,}C[a-z]{1,}$')

S = input()
if bool(p.match(S)):
    print('AC')
else:
    print('WA')
Buggy code:
S = input()

cap = S[0]
mid = list(S[2:-1])
print(mid)

if (mid.count('C') >= 1):
    index = S.index('C')
    strr = S[1:index] + S[index + 1 :]
else:
    print('WA')
    exit()


if (cap == 'A' and mid.count('C') == 1 and strr.islower() == True):
    print('AC')
else:
    print('WA')


Fixed code:
S = input()

cap = S[0]
mid = list(S[2:-1])

if (mid.count('C') >= 1):
    index = S.index('C')
    strr = S[1:index] + S[index + 1 :]
else:
    print('WA')
    exit()


if (cap == 'A' and mid.count('C') == 1 and strr.islower() == True):
    print('AC')
else:
    print('WA')
Buggy code:
S=input()
ans="WA"
if S[0]=="A" and S[2:-1].count("C")==1:
  s=S.find("C",2,-1)-
  SS=S[1:s]+S[s+1:]
  if SS.islower() is True:
    ans="AC"
print(ans)

Fixed code:
S=input()
ans="WA"
if S[0]=="A" and S[2:-1].count("C")==1:
  s=S.find("C",2,-1)
  S=S[1:s]+S[s+1:]
  if S.islower() is True:
    ans="AC"
print(ans)
Buggy code:
s_list = list(input())
s_list1 = s_list
count = 0

if s_list[0] == "A":
    del s_list[:2], s_list[-1]
    for i in range(len(s_list)):
        if s_list[i] == "C":
            count += 1
            isC = i + 2
    if count != 1:
        print("WA")
    else:
        del s_list1[isC]
        Str = "".join(s_list1)
        if Str.islower():
            print("AC")
        else:
            print("WA")
else:
    print("WA")

Fixed code:
s_list = list(input())
s_list1 = s_list[1:]
count = 0

if s_list[0] == "A":
    del s_list[:2], s_list[-1]
    for i in range(len(s_list)):
        if s_list[i] == "C":
            count += 1
            isC = i + 1
    if count != 1:
        print("WA")
    else:
        del s_list1[isC]
        Str = "".join(s_list1)
        if Str.islower():
            print("AC")
        else:
            print("WA")
else:
    print("WA")
Buggy code:
s=input()
result=""
count=0
l=len(s)
if s[0]!="A":
  result="WA"
elif ord(s[1:2])<97 or ord(s[l-1])<97:
  result="WA"
for i in s[2:l-1]:
  if ord(i)<97:
    count+=1
  if count>1:
    result="WA"
    break
if count==0:
  result="WA"
print(result)


Fixed code:
s=input()
result=""
count=0
l=len(s)
if s[0]!="A":
  result="WA"
elif ord(s[1:2])<97 or ord(s[l-1])<97:
  result="WA"
for i in s[2:l-1]:
  if ord(i)<97:
    count+=1
  if ord(i)<97 and i!="C":
    result="WA"
    break
  if count>1:
    result="WA"
    break
if count==0:
  result="WA"
if result!="WA":
  result="AC"
print(result)
Buggy code:
s = list(input())
al = list("abcdefghijklmnopqrstuvwxyz")
if s[0] == "A" and s[-1] in al:
    del s[0]
    del s[-1]
    f = 0
    for i in s:
        if i == "C":
            if f == 1:
                print("WA")
                break
            else:
                continue
        else:
            if i in al:
                continue
            else:
                print("WA")
                break
    else:
        print("AC")
else:
    print("WA")

Fixed code:
s = list(input())
al = list("abcdefghijklmnopqrstuvwxyz")
if s[0] == "A" and s[-1] in al and s[1] in al:
    del s[0]
    del s[0]
    del s[-1]
    f = 0
    for i in s:
        if i == "C":
            if f == 1:
                print("WA")
                break
            else:
                f = 1
                continue
        else:
            if i in al:
                continue
            else:
                print("WA")
                break
    else:
        if f == 1:
            print("AC")
        else:
            print("WA")
else:
    print("WA")
Buggy code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = list(input())

    isWA = False
    if S[0] != 'A':
        isWA = True

    if S[2:-2].count('C') != 1:
        isWA = True

    for s in S:
        if s == 'A' or s == 'C':
            continue
        if s.isupper():
            isWA = True

    if isWA:
        print('WA')
    else:
        print('AC')
    

if __name__ == '__main__':
    main()


Fixed code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = list(input())

    isWA = False
    if S[0] != 'A':
        isWA = True

    if S[2:-1].count('C') != 1:
        isWA = True

    for s in S:
        if s == 'A' or s == 'C':
            continue
        if s.isupper():
            isWA = True

    if isWA:
        print('WA')
    else:
        print('AC')
    

if __name__ == '__main__':
    main()
Buggy code:
S = list(input())
print(S)
small = [chr(i) for i in range(97,97+26)]
print(small)
count = 0
ans = 'AC'
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            ans = 'WA'
            break
    elif i == 1:
        if S[i] not in small:
            ans = 'WA'
            break
    elif i != len(S)-1:
        if S[i] == 'C':
            count += 1
        elif S[i] not in small:
            ans = 'WA'
            break
    else:
        if S[i] not in small:
            ans = 'WA'
if ans == 'AC' and count != 1:
    ans = 'WA'
print(ans)


Fixed code:
S = list(input())
small = [chr(i) for i in range(97,97+26)]
count = 0
ans = 'AC'
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            ans = 'WA'
            break
    elif i == 1:
        if S[i] not in small:
            ans = 'WA'
            break
    elif i != len(S)-1:
        if S[i] == 'C':
            count += 1
        elif S[i] not in small:
            ans = 'WA'
            break
    else:
        if S[i] not in small:
            ans = 'WA'
if ans == 'AC' and count != 1:
    ans = 'WA'
print(ans)
Buggy code:
import sys

input = sys.stdin.readline


def judg(s):
    if s[0] != "A":
        return False
    if "C" not in s[2:-1] and s[2:-1].count("C") != 1:
        print("C")
        return False
    del s[s.index("C")]
    s = "".join(s[1:])
    if s.lower() != s:
        return False
    return True


def main():
    s = list(input().strip())

    if judg(s):
        print("AC")
    else:
        print("WA")


if __name__ == "__main__":
    main()


Fixed code:
import sys

input = sys.stdin.readline


def judg(s):
    if s[0] != "A":
        return False
    if "C" not in s[2:-1] and s[2:-1].count("C") != 1:
        return False
    del s[s.index("C")]
    s = "".join(s[1:])
    if s.lower() != s:
        return False
    return True


def main():
    s = list(input().strip())

    if judg(s):
        print("AC")
    else:
        print("WA")


if __name__ == "__main__":
    main()
Buggy code:
s = input()
t = list(s)
x = 0
y = 0
z = 0
r = []

if t[0] == "A":
  x = 1
  
r.append(t[1])
r.append(t[len(t) - 1])

for i in range(2,len(t) - 1): 
  if t[i] == "C":
    y += 1
  else:
    r.append(t[i])

for j in r:
  if j.isupper():
    z = 1

if x = 1 and y = 1 and z = 0:
  print("AC")
else:
  print("WA")


Fixed code:
s = input()
t = list(s)
x = 0
y = 0
z = 0
r = []

if t[0] == "A":
  x = 1
  
r.append(t[1])
r.append(t[len(t) - 1])

for i in range(2,len(t) - 1): 
  if t[i] == "C":
    y += 1
  else:
    r.append(t[i])

for j in r:
  if j.isupper():
    z = 1

if x == 1 and y == 1 and z == 0:
  print("AC")
else:
  print("WA")
Buggy code:
import sys
s = input("")

count_c = 0

if(s[0] == "A"):
    for i in range(1, len(s)):
        if(s[i]=="C" and i >= 2 and i <= len(s)-2):
            count_c += 1
        elif(i.isupper):
            print("WA")
            sys.exit()
            
        
    if(count_c != 1):
        print("WA")
    else:
        print("AC")
else:
    print("WA")

Fixed code:
import sys
s = input("")

count_c = 0

if(s[0] == "A"):
    for i in range(1, len(s)):

        if(s[i]=="C" and i >= 2 and i <= len(s)-2):
            count_c += 1
        elif(s[i].isupper()):
            print("WA")
            sys.exit()
            
        
    if(count_c != 1):
        print("WA")
    else:
        print("AC")
else:
    print("WA")
Buggy code:
s = input()
cnt = 0
if s[0] == 'A' and s[1].islower() and s[-1].islower():
    for i in range(len(s)-4):
        if s[i+2] == 'C':
            cnt += 1
        elif s[i+2].islower():
            continue
        else:
            cnt = None
            break
if cnt == 1:
    print('AC')
else:
    print('WA')

Fixed code:
s = input()
cnt = 0
if s[0] == 'A' and s[1].islower() and s[-1].islower():
    for i in range(len(s)-3):
        if s[i+2] == 'C':
            cnt += 1
        elif s[i+2].islower():
            continue
        else:
            cnt = None
            break
if cnt == 1:
    print('AC')
else:
    print('WA')
Buggy code:
S = list(input())

if S[0] == 'A' and S[2:len(S) - 2].count('C') == 1:
    S.remove('A')
    S.remove('C')
    if ''.join(S).islower:
        print('AC')
    else:
        print('WA')
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')
    if ''.join(S).islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
s=input()
character=["q","w","e","r","t","y","u","i","o","p","l","k","j","h","g","f","d","s","a","z","x","c","v","b","n","m"]
flag=0
for i in range(len(s)):
    if i==0:
        if s[i]!="A":
            print("WA")
            exit()
    elif 2<=i or i<=len(s)-2:
        if flag==1 and s[i]=="C":
            print("WA")
            exit()
        elif flag==0 and s[i]=="C":
            flag=1
        elif flag==0 and not s[i] in character:
            print("WA")
            exit()
        elif flag==1 and not s[i] in character:
            print("WA")
            exit()
    else:
        if not s[i] in character:
            print("WA")
            exit()
if flag==0:
    print("WA")
    exit()
print("AC")


Fixed code:
s=input()
character=["q","w","e","r","t","y","u","i","o","p","l","k","j","h","g","f","d","s","a","z","x","c","v","b","n","m"]
flag=0
for i in range(len(s)):
    if i==0:
        if s[i]!="A":
            print("WA")
            exit()
    elif 2<=i<=len(s)-2:
        if flag==1 and s[i]=="C":
            print("WA")
            exit()
        elif flag==0 and s[i]=="C":
            flag=1
        elif flag==0 and not s[i] in character:
            print("WA")
            exit()
        elif flag==1 and not s[i] in character:
            print("WA")
            exit()
    else:
        if not s[i] in character:
            print("WA")
            exit()
if flag==0:
    print("WA")
    exit()
print("AC")
Buggy code:
S=str(input())
letter="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
condition1 = S[0]=='A'
condition2 = len([1 for x in S[2:len(S)-1] if x=="C"]) == 1
count=0
for i in len(S):
  if len([1 for x in letter if x==S[i]]) == 1:
    count = count + 1
condition3 = count == 2
if condition1 & condition2 & condition3:
  print('AC')
else:
  print('WA')


Fixed code:
S=str(input())
letter="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
condition1 = S[0]=='A'
condition2 = len([1 for x in S[2:len(S)-1] if x=="C"]) == 1
count=0
for i in range(len(S)):
  if len([1 for x in letter if x==S[i]]) == 1:
    count = count + 1
condition3 = count == 2
if condition1 & condition2 & condition3:
  print('AC')
else:
  print('WA')
Buggy code:
import sys

def resolve():
    S = input()
    if S[0] == "A" and S[2:len(S)].count("C") == 1:
         if S[1:].replace("C", "").islower():
             print("AC")
             return
    print("WA")

if '__main__' == __name__:
    resolve()

Fixed code:
import sys

def resolve():
    S = input()
    if S[0] == "A" and S[2:len(S)-1].count("C") == 1:
         if S[1:].replace("C", "").islower():
             print("AC")
             return
    print("WA")

if '__main__' == __name__:
    resolve()
Buggy code:
S=input()
flag=False

if S[0]=="A":
  if S[2:-1].count("C")==1:
    pos=S.find("C")
    T=S[1:pos]+S[pos+1:]
    if T.islower():
      print("AC")
      flag=True
      
if flag=False:
  print("WA")

Fixed code:
S=input()
flag=False

if S[0]=="A":
  if S[2:-1].count("C")==1:
    pos=S.find("C")
    T=S[1:pos]+S[pos+1:]
    if T.islower():
      print("AC")
      flag=True
      
if flag==False:
  print("WA")
Buggy code:
import sys
input = sys.stdin.readline
S = list(input())
N = len(S)
cnt = 0
for i in S:
    cnt += i.isupper()
if cnt != 2:
    print("WA")
    sys.exit()
if S[0] != "A":
    print("WA")
    sys.exit()
if "C" not in S[2:N-1]:
    print("WA")
print("AC") 


Fixed code:
import sys
input = sys.stdin.readline
S = list(input().rstrip())
N = len(S)
cnt = 0
for i in S:
    cnt += i.isupper()
if cnt != 2:
    print("WA")
    sys.exit()
if S[0] != "A":
    print("WA")
    sys.exit()
if "C" not in S[2:N-1]:
    print("WA")
    sys.exit()
print("AC")
Buggy code:
s=input()
if s[0]!="A" and s[2:-1].count("C")!=1:
      print("WA")
      exit()

s=list(s)
s[0]="a"
s.remove("C")
if "".join(s).islower():
      print('AC')
else:
      print("WA")

Fixed code:
s=input()
if s[0]!="A":
      print("WA")
      exit()
if s[2:-1].count("C")!=1:
      print("WA")
      exit()

s=list(s)
s[0]="a"
s.remove("C")
if "".join(s).islower():
      print('AC')
else:
      print("WA")
Buggy code:
s = input()
if s[0]=="A" and s[2:-1].count("C")==1 and s[1].islower():
    s = s.replace("C", "")
    if s[1:].islower():
        print("AC")
        exit()
print("Wa")

Fixed code:
s = input()
if s[0]=="A" and s[2:-1].count("C")==1 and s[1].islower():
    s = s.replace("C", "")
    if s[1:].islower():
        print("AC")
        exit()
print("WA")
Buggy code:


S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    a = S[2:-1].replace('C','c')
    if a.islower() and S[-1].islower()
        ans='AC'
        
print(ans)
    
    

Fixed code:


S = input()

ans = 'WA'

if S[0] == 'A' and S[2:-1].count('C') == 1:
    a = S[2:-1].replace('C','c')
    if a.islower() and S[-1].islower() and S[1].islower():
        ans='AC'
        
print(ans)
Buggy code:
import sys
import re


cnt = 1
input_arr = []
for l in sys.stdin:
  input_arr.append(l.split("\n")[0])
  if len(input_arr) == cnt:
      break
S = input_arr[0]
if S[0] == "A" and len(re.sub(r'[a-z]+', '', S[1]+S[-0]+S[2:-1].replace("C","",1))) == 0:
    print("AC")
else:
    print("WA")

Fixed code:
import sys
import re


cnt = 1
input_arr = []
for l in sys.stdin:
  input_arr.append(l.split("\n")[0])
  if len(input_arr) == cnt:
      break
S = input_arr[0]
if len(re.sub(r'A[a-z]+C[a-z]+', '', S)) == 0:
    print("AC")
else:
    print("WA")
Buggy code:
s = input()
ans = 'AC'

if s[0] != 'A':
  ans = 'WA'

if 'C' not in s[2:-1]:
  ans = 'WA'
  
if not s.replace('A', '').replace('C', '').islower():
  ans = 'WA'
  
print(ans)

Fixed code:
s = input()
ans = 'AC'

if s[0] != 'A':
  ans = 'WA'

if 'C' not in s[2:-1]:
  ans = 'WA'
  
if s[2:-1].count('C') != 1:
  ans = 'WA'
  
if not s.replace('A', '').replace('C', '').islower():
  ans = 'WA'
  
print(ans)
Buggy code:
s = list(input())
temp_s = s[1:-1]
#print(temp_s)

if (s[0]=="A")and("C" in temp_s):
  s.remove("A")
  s.remove("C")
  if len(set(s) - set(list("".join(s).lower())))==0:
    print("AC")
  else:
    print("WA")
else:
    print("WA")

Fixed code:
s = list(input())
temp_s = s[2:-1]
#print(temp_s)

if (s[0]=="A")and("C" in temp_s):
  s.remove("A")
  s.remove("C")
  temp = s.copy()
  if len(set(s) - set(list("".join(temp).lower())))==0:
    print("AC")
  else:
    print("WA")
else:
    print("WA")
Buggy code:
s = list(input())
flag = True
if s[0] != "A":
    flag = False
c = False
if s[1].islower():
    flag = False
for i in range(len(s) - 3):
    if s[i + 2] == "C":
        if c:
            flag = False
        c = True
    else:
        if s[i + 2].islower():
            flag = False

if s[-1].islower():
    flag = False


if flag and c:
    print("AC")
else:
    print("WA")


Fixed code:
s = list(input())
flag = True
if s[0] != "A":
    flag = False
c = False
if s[1].isupper() and s[1] != "A" and s[1] != "C":
    flag = False
for i in range(len(s) - 3):
    if s[i + 2] == "C":
        if c:
            flag = False
        c = True
    else:
        if s[i + 2].isupper() and s[i + 2] != "A" and s[i + 2] != "C":
            flag = False

if s[-1].isupper() and s[-1] != "A" and s[-1] != "C":
    flag = False


if flag and c:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()
flg = 0
if S[0] == 'A':
    flg += 1
if S[1].isupper():
    flg += 1000
for i in range(2, len(S)-1):
    if S[i] == 'C':
        flg += 10
    elif S[i].isupper():
        flg += 1000
if S[-1].isupper():
    flg += 1000
print(flg)
if flg == 11:
    print('AC')
else:
    print('WA')


Fixed code:
S = input()
flg = 0
if S[0] == 'A':
    flg += 1
if S[1].isupper():
    flg += 1000
for i in range(2, len(S)-1):
    if S[i] == 'C':
        flg += 10
    elif S[i].isupper():
        flg += 1000
if S[-1].isupper():
    flg += 1000
if flg == 11:
    print('AC')
else:
    print('WA')
Buggy code:
a = input()
b = a[2:-1]
if a.startswith("A"):
    if b.count("C") == 1:
        c = list(a)
        c.remove("A")
        c.remove("C")
        print(c)
        for i in c:
            if i.isupper():
                break
        print("AC")
        exit()
print("WA")


Fixed code:
a = input()
b = a[2:-1]
if a.startswith("A"):
    if b.count("C") == 1:
        c = list(a)
        c.remove("A")
        c.remove("C")
        for i in c:
            if i.isupper():
                print("WA")
                exit()
        print("AC")
        exit()
print("WA")
Buggy code:
s = input()
ans = 0
if s[0] == 'A':
    ans += 1
cnum = 0
for i in range(2,len(s)):
    if s[i] == 'C':
        cnum += 1
if cnum == 1:
    ans += 1
hantei = 0
for i in range(len(s)):
    if s[i].islower():
        pass
    else:
        hantei += 1
if hantei == 2:
    ans += 1
if ans == 3:
    print('AC')
else:
    print('WA')

Fixed code:
s = input()
ans = 0
if s[0] == 'A':
    ans += 1
cnum = 0
for i in range(2,len(s)-1):
    if s[i] == 'C':
        cnum += 1
if cnum == 1:
    ans += 1
hantei = 0
for i in range(len(s)):
    if s[i].islower():
        pass
    else:
        hantei += 1
if hantei == 2:
    ans += 1
if ans == 3:
    print('AC')
else:
    print('WA')
Buggy code:
S = input()
l = len(S)
c = 0
if S[0] == 'A':
  n = 1
  while n < l:
    if S[n] == 'C' and n not in [1, l-1]:
      c = 1
    elif S[n].isupper():
      break
    n += 1
  if c == 1:
    print('AC')
  else:
    print('WA')
else:
  print('WA')

Fixed code:
S = input()
l = len(S)
c = 0
if S[0] == 'A':
  n = 1
  while n < l:
    if S[n] == 'C' and n not in [1, l-1]:
      c += 1
    elif S[n].isupper():
      c = 0
      break
    n += 1
  if c == 1:
    print('AC')
  else:
    print('WA')
else:
  print('WA')
Buggy code:
S = input()
if S[0] == 'A' and 'C' in S[2:-1] and S[1:].replace('C', '', 1).lower():
	print('AC')
else:
	print('WA')


Fixed code:
S = input()
if S[0] == 'A' and 'C' in S[2:-1] and S[1:].replace('C', '', 1).islower():
	print('AC')
else:
	print('WA')
Buggy code:
S=str(input)
slist=list(S)
flag=0
if slist[0]!="A":
  flag=1
klist=slist[2:-1]
c=klist.count("C")
if c!=1:
  flag=1
del slist[0]
if "C" in slist:
  slist.remove("C")
SS=""
for x in slist:
  SS+=x
if SS.islower():
  pass
else:
  flag=1
if flag==0:
  print("AC")
else:
  print("WA")

Fixed code:
S=str(input())
slist=list(S)
flag=0
if slist[0]!="A":
  flag=1
klist=slist[2:-1]
c=klist.count("C")
if c!=1:
  flag=1
del slist[0]
if "C" in slist:
  slist.remove("C")
SS=""
for x in slist:
  SS+=x
if SS.islower():
  pass
else:
  flag=1
if flag==0:
  print("AC")
else:
  print("WA")
Buggy code:
S=list(input())
flag=0
Ccount=0
Cnumber=0
if S[0]=="A":
  flag+=1
  del S[0]
if S.count("C")==1:
  flag+=1
  S.remove("C")
if str(S).islower():
  flag+=1
if flag==3:
  print("AC")
else:
  print("WA")

Fixed code:
S=list(input())
flag=0
Ccount=0
Cnumber=0
if S[0]=="A":
  flag+=1
if S[2:-1].count("C")==1:
  flag+=1
  del S[0]
  S.remove("C")
if str(S).islower():
  flag+=1
if flag==3:
  print("AC")
else:
  print("WA")
Buggy code:
S = list(input())
L = S[2:len(S)-1]
a = 0
for i in range(len(S)):
    if 64 < (ord(S[i])) <= 90:
        a = a+1

if L.count("C") == 1 and S[0] == "A" and a == 1:
    print("AC")
else:
    print("WA")


Fixed code:
S = list(input())
L = S[2:len(S)-1]
a = 0
for i in range(len(S)):
    if 65 < (ord(S[i])) <= 90:
        a = a+1

if L.count("C") == 1 and S[0] == "A" and a == 1:
    print("AC")
else:
    print("WA")
Buggy code:
s=input()
flg=True
if s[i]!="A":
    flg=False
cnt=0
for i in s[3:-2]:
    if i=="C":
        cnt+=1
if cnt!=1:
    flg=False
cnt=0
for i in s:
    if i.isupper():
        cnt+=1
if cnt!=2:
    flg=False
if flg:
    print("AC")
else:
    print("WA")


Fixed code:
s=input()
flg=True
if s[0]!="A":
    flg=False
cnt=0

for i in s[2:-1]:
    if i=="C":
        cnt+=1
#print(cnt)
if cnt!=1:
    flg=False
cnt=0
for i in s:
    if i.isupper():
        cnt+=1
if cnt!=2:
    flg=False
if flg:
    print("AC")
else:
    print("WA")
Buggy code:
s = input()
print('AC' if 'A' in s and 'C' in s and s[1:].replace('C','',1).islower() else 'WA')

Fixed code:
s = input()
print('AC' if 'A' in s and 'C' in s[2:-1] and s[1:].replace('C','',1).islower() else 'WA')
Buggy code:
s = input()
if s[0] != "A":
    print("WA")
    exit()
if s[1].isupper():
    print("WA")
    exit()
if s[-1].isupper() or s[-1] == "C":
    print("WA")
    exit()
flag = False
for c in s[3:]:
    if c == "C":
        if flag:
            print("WA")
            exit()
        else:
            flag = True
    if c.isupper():
        print("WA")
        exit()
if flag:
    print("AC")
else:
    print("WA")

Fixed code:
s = input()
if s[0] != "A":
    print("WA")
    exit()
if s[1].isupper():
    print("WA")
    exit()
if s[-1].isupper() or s[-1] == "C":
    print("WA")
    exit()
flag = False
for c in s[2:]:
    if c == "C":
        if flag:
            print("WA")
            exit()
        else:
            flag = True
    else:
        if c.isupper():
            print("WA")
            exit()
if flag:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()
count = 0

if S[0] == 'A':
    count += 1
if 'C' in S[2:-1]:
    count += 1
print(S)
S = S.replace("A", "")
S = S.replace("C", "")

if S.islower():
    count += 1

if count == 3:
    print("AC")
else:
    print('WA')

Fixed code:
S = input()
count = 0

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

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

Fixed code:
s = input()
b = 0
if s[0] == "A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower():
    print("AC")
else:
    print("WA")
Buggy code:
def checker():
    s = input()
    if s[0] != "A":
        return 0
    if s[2:-1].count("C") != 1:
        return 0
    s.pop(0)
    s.pop(s.index("C"))
    if s != s.lower():
        return 0
    return 1

l = ["WA", "AC"]

print(l[checker()])

Fixed code:
def checker():
    s = input()
    if s[0] != "A":
        return 0
    if s[2:-1].count("C") != 1:
        return 0
    num = s.index("C")
    s = s[1:num] + s[num+1:]
    if s != s.lower():
        return 0
    return 1

l = ["WA", "AC"]

print(l[checker()])
Buggy code:
S = input()

flag = True

if S[0] != 'A':
    flag = False

idx = None
for i, s in enumerate(S[3:-1]):
    if s == 'C':
        if idx == None:
            idx = i + 3
        else:
            flag = False

for i, s in enumerate(S):
    if i == 0 or i == idx:
        continue

    if s != s.lower():
        flag = False

if flag:
    print("AC")
else:
    print("WA")

Fixed code:
S = input()

flag = True

if S[0] != 'A':
    flag = False

idx = None
for i, s in enumerate(S[2:-1]):
    if s == 'C':
        if idx == None:
            idx = i + 2
        else:
            flag = False

if idx == None:
    flag = False

for i, s in enumerate(S):
    if i == 0 or i == idx:
        continue

    if s != s.lower():
        flag = False

if flag:
    print("AC")
else:
    print("WA")