qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys

s = input()
if s[0] == "A" and s.count("C") == 1 and "C" in s[2:-1]:
    ss = set(s)
    ss.remove("A")
    ss.remove("C")
    SS = [i.upper() for i in ss]
    if len(ss & SS) == 0:
        print("AC")
        sys.exit()

print("WA")

Fixed code:
import sys

s = input()
if s[0] == "A" and s.count("C") == 1 and "C" in s[2:-1]:
    ss = set(s)
    ss.remove("A")
    ss.remove("C")
    SS = set([i.upper() for i in ss])
    if len(ss & SS) == 0:
        print("AC")
        sys.exit()

print("WA")
Buggy code:
s=input()
n=len(s)

res='WA'
cnt=0
cnt2=0

if s[0]=='A':
	for i in range(1,n-1):
		if s[i]=='C':
			cnt+=1
	for i in range(1,n):
		if s[i].isupper() and s[i]!='C':
			cnt2+=1
	if cnt==1 and cnt2==0:
		res='AC'
        
print(res)

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

res='WA'
cnt=0
cnt2=0

if s[0]=='A':
	for i in range(2,n-1):
		if s[i]=='C':
			cnt+=1
	for i in range(1,n):
		if s[i].isupper() and s[i]!='C':
			cnt2+=1
	if cnt==1 and cnt2==0:
		res='AC'
        
print(res)
Buggy code:
s = list(input())
if "A" != s[0]:
    print("WA")
    exit()
s_extracted = s[2:-1]
if s_extracted.count("C") != 1:
    print("WA")
    exit()
else:
    # Get Upper characters without "C"
    s_upper = [
        chara for chara in s
        if chara != "C" and chara != "C" and chara.isupper()
    ]
    if len(s_upper) > 0:
        print("WA")
        exit()
print("AC")

Fixed code:
s = list(input())

if "A" != s[0]:
    print("WA")
    exit()
s_extracted = s[2:-1]
if s_extracted.count("C") != 1:
    print("WA")
    exit()
# Get Upper characters without "A", "C"
s_upper = [
    chara for chara in s if chara != "C" and chara != "A" and chara.isupper()
]
if len(s_upper) > 0:
    print("WA")
    exit()

print("AC")
Buggy code:
s = input()
if s[0]  == 'A' and s[1:-1].count('C') == 1:
    for n in s[1:]:
        if n.islower():
            continue
        else:
            if n == 'C':
                continue
            else:
                print('WA')
                exit()
else:
    print('WA')
    exit()
print('AC')

Fixed code:
s = input()

if s[0]  == 'A' and s[2:-1].count('C') == 1:
    for n in s[1:]:
        if n.islower():
            continue
        else:
            if n == 'C':
                continue
            else:
                print('WA')
                exit()
else:
    print('WA')
    exit()
print('AC')
Buggy code:
s = input()
ans = True

if s[0] != 'A':
    ans = False
    print(f's[0]:{s[0]}')

index = -1
between_bigin_3_and_end_2 = s[2:-1]
count = between_bigin_3_and_end_2.count('C')
if count == 1:
    index = s.index('C')
    # print(index)
else:
    ans = False
    print(f'between_bigin_3_and_end_2:{between_bigin_3_and_end_2}')
    print(f'count:{count}')

    
for i in range(len(s)):
    if i == 0:
        continue
    if i == index:
        continue
    if not s[i].islower():
        ans = False


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

Fixed code:
s = input()
ans = True

if s[0] != 'A':
    ans = False
    # print(f's[0]:{s[0]}')

index = -1
between_bigin_3_and_end_2 = s[2:-1]
count = between_bigin_3_and_end_2.count('C')
if count == 1:
    index = s.index('C')
    # print(index)
else:
    ans = False
    # print(f'between_bigin_3_and_end_2:{between_bigin_3_and_end_2}')
    # print(f'count:{count}')

    
for i in range(len(s)):
    if i == 0:
        continue
    if i == index:
        continue
    if not s[i].islower():
        ans = False


if ans:
    print('AC')
else:
    print('WA')
Buggy code:
S=input()
if(S[0]=="A" and S[2,-1].count("C")==1):
    cnt=0
    for i in S:
        if(97<=ord(i) and ord(i)<=122):
            cnt+=1
    if(cnt==2):
            print("AC")
    else :
            print("WA")
else :
    print("WA")

Fixed code:
S = input()
if(S[0]=='A' and S[2:-1].count('C') == 1):
  cnt = 0
  for i in S:
    if(not (97<=ord(i) and ord(i)<=122)):
      cnt+=1
  if(cnt==2):
    print('AC')
  else:
    print('WA')
else:
  print('WA')
Buggy code:
s = input()

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

if s[1].isupper() or s[-1].isupper():
    print("WA")
    exit()

count = 0
for i in s[2:]:
    if s[i].isupper():
        if s[i] == "C":
            count += 1
        else:
            print("WA")
            exit()
        

if count == 1:
    print("AC")
else:
    print("WA")

Fixed code:
s = input()

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

if s[1].isupper() or s[-1].isupper():
    print("WA")
    exit()

count = 0
for s_ in s[2:]:
    if s_.isupper():
        if s_ == "C":
            count += 1
        else:
            print("WA")
            exit()
        

if count == 1:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()
CS = S[2:-1]
print(CS)
if S[0] == 'A':
  S = S.lstrip('A')
  if CS.count('C') == 1:
    S = S.replace('C', '')
    if S.islower() == True:
      print('AC')
    else:
      print('WA')
  else:
    print('WA')
else:
  print('WA')

Fixed code:
S = input()
CS = S[2:-1]
if S[0] == 'A':
  S = S.lstrip('A')
  if CS.count('C') == 1:
    S = S.replace('C', '')
    if S.islower() == True:
      print('AC')
    else:
      print('WA')
  else:
    print('WA')
else:
  print('WA')
Buggy code:
s = list(input())
print(s)
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.count('C') == 1:
     s.remove('A')
     s.remove('C')
     print(s)
     if str(s).islower() == 0:
          print('AC')
     else:
          print('WA')
else:
     print('WA')

Fixed code:
s = list(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.count('C') == 1:
     s.remove('A')
     s.remove('C')
     if str(s).islower() == True:
          print('AC')
     else:
          print('WA')
else:
     print('WA')
Buggy code:
s = list(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.count('C') == 1:
     s.remove('A')
     s.remove('C')
     if (''.join(s)).islower() == 0:
          print('AC')
     else:
          print('WA')
else:
     print('WA')

Fixed code:
s = list(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.count('C') == 1:
     s.remove('A')
     s.remove('C')
     if (''.join(s)).islower() == True:
          print('AC')
     else:
          print('WA')
else:
     print('WA')
Buggy code:
s = input()
ans = 'WA'
a = []
if s[0] == 'A' and s[2:-1].count('C') == 1:
     a = list(s)
     a.remove('A')
     a.remove('C')
     a = str(a)
     if a.islower() == 0:
          ans = 'AC'
print(ans)

Fixed code:
s = input()
ans = 'WA'
a = []
if s[0] == 'A' and s[2:-1].count('C') == 1:
     a = list(s)
     a.remove('A')
     a.remove('C')
     a = str(a)
     if a.islower() == True:
          ans = 'AC'
print(ans)
Buggy code:
s=input()
c=False
if s[0]=='A':
  if 'C' in s[2:-1]:
    s=s.replace('A','').replace('C','')
    if s.islower()==True:
      c=True
if c==True:
  print('AC')
else:
  print('WA')
    

Fixed code:
s=input()
c=True
if s[0]=='A':
  if 'C' in s[2:-1]:
    s=s.replace('A','',1).replace('C','',1)
    if s.islower()==True:
      c=False
if c==False:
  print('AC')
else:
  print('WA')
Buggy code:
# ABC  104 B, accepted
from collections import Counter

S = input()
if S[0] == 'A':
    t = Counter(S[2:-1])
    if t['C'] == 1:
        S=S.replace('A', '')
        S=S.replace('C', '')
        print(S)
        if S.islower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')



Fixed code:
# ABC  104 B, accepted
from collections import Counter

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

Fixed code:
s=input()
ans='WA'
if s[0]=='A':
  if s[2:-1].count('C')==1:
    c=s.index('C')
    if s[1:c].islower() and s[c+1:].islower():
      ans='AC'
print(ans)
Buggy code:
import re

s = input()

if not s.startswith('A'):
    print('WA')
elif s[2:len(s) - 3].count('C') == 1:
    print('WA')
elif len(re.findall('[A-Z]', s)) != 2:
    print('WC')
else:
    print('AC')


Fixed code:
import re

s = input()

if not s.startswith('A'):
    print('WA')
elif s[2:len(s) - 1].count('C') != 1:
    print('WA')
elif len(re.findall('[A-Z]', s)) != 2:
    print('WA')
else:
    print('AC')
Buggy code:
S = input()
flag = False
if S[0] == "A":
    count = 0
    for i,j in enumerate(S[2:-1]):
        if j == "C":
            count+=1
            ind = i+2
    if count == 1:
        tmp = S[1:ind]+A[ind+1:]
        if tmp == tmp.lower():
            flag = True
            
if flag:
    print("AC")
else:
    print("WA")

Fixed code:
S = input()
flag = False
if S[0] == "A":
    count = 0
    for i,j in enumerate(S[2:-1]):
        if j == "C":
            count+=1
            ind = i+2
    if count == 1:
        tmp = S[1:ind]+S[ind+1:]
        if tmp == tmp.lower():
            flag = True
            
if flag:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()
ans = "AC"

if S[0] != "A":
    ans = "WA"

cnt = 0

for i in range(1, len(S)):
    s = S[i]
    if s.isupper():
        if s != "C":
            ans = "WA"
        cnt += 1

if cnt != 1:
    ans = "WA"

print(ans)


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

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

cnt = 0

for i in range(1, len(S)):
    s = S[i]
    if s.isupper():
        if i == 1 or i == len(S) - 1 or s != 'C':
            ans = 'WA'
        cnt += 1

if cnt != 1:
    ans = 'WA'

print(ans)
Buggy code:
S = input()

if S[0] == "A" and S[2:-1].count("C") == 1:
  index =  S.index('C')
  S = S[1:index] + S[index + 1:]
  print(S)
  if S.islower():
    print("AC")
    exit()
else:
  print("WA")



Fixed code:
S = input()

if S[0] == "A" and S[2:-1].count("C") == 1:
  index = S.index('C')
  S = S[1:index] + S[index + 1:]
  if S.islower():
    print("AC")
    exit()

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

Fixed code:
s=input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and s.replace('A','').replace('C','') == s.replace('A','').replace('C','').lower():
    print('AC')
else:
    print('WA')
Buggy code:
s = list(input())
if (s[0] == "A") and (s[2:-1].count("C")):
    print("aa")
    s[0] = "a"
    s[s[2:-2].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")

Fixed code:
s = list(input())
if (s[0] == "A") and (s[2:-1].count("C")==1):
    s[0] = "a"
    s[s[2:-1].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")
Buggy code:
s=str(input())
f=s[0]=="A" and s[2:-1].count("C")==1
g=(s[:2]+s[2:-1].replace("A","a").replace("C","c")+s[-1]).islower()
h=f and g
print("AC" if h is True else "WA")

Fixed code:
s=str(input())
f=s[0]=="A" and s[2:-1].count("C")==1
g=(s[1]+s[2:-1].replace("A","a").replace("C","c")+s[-1]).islower()
h=f and g
print("AC" if h is True else "WA")
Buggy code:
s = input()
res = "AC" if (s[0]=='A' and s[2:-1].count('C') == 1 and s[1:].replace('C','',1).islower()) else "WC"
print(res)

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

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

alpha2num = lambda c: ord(c) - ord('a') + 1

s = input()
ans = "WA"
if s[0] == "A" and s.count("C") == 1:
    if 2 <= s.index("C") <= len(s) - 2:
        for i in range(1, len(s)):
            if i != s.index("C") and 1 <= alpha2num(s[i]) <= 26:
                ans = "AC"
                continue
            else:
                ans = "WA"
                break
print(ans)

Fixed code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

alpha2num = lambda c: ord(c) - ord('a') + 1

s = input()
ans = "WA"
if s[0] == "A" and s.count("C") == 1:
    if 2 <= s.index("C") <= len(s) - 2:
        for i in range(1, len(s)):
            if i == s.index("C"):
                continue
            elif 1 <= alpha2num(s[i]) <= 26:
                ans = "AC"
            else:
                ans = "WA"
                break
print(ans)
Buggy code:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
if len([s for s in S[3:-2] if s == 'C']) != 1:
    print('WA')
    exit()
SL = [s for s in S if s not in ['A', 'C']]
if not all([sl.islower() for sl in SL]) or len(SL) + 2 != len(S):
    print('WA')
    exit()
print('AC')

Fixed code:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
if len([s for s in S[2:-1] if s == 'C']) != 1:
    print('WA')
    exit()
SL = [s for s in S if s not in ['A', 'C']]
if not all([sl.islower() for sl in SL]) or len(SL) + 2 != len(S):
    print('WA')
    exit()
print('AC')
Buggy code:
import sys
S = list(input())
# S = "Atcoder"
# S = list(S)

if S[0] != "A":
    print("WA")
    sys.exit()
elif S[1].isupper():
    print("WA")
    sys.exit()
elif S[-1].isupper():
    print("WA")
    sys.exit()
elif "C" in S[2:-1]:
    S.remove("C")
    S.remove(0)
    S = str(S)
    if S.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Fixed code:
import sys
S = list(input())
# S = "Atcoder"
# S = list(S)

if S[0] != "A":
    print("WA")
    sys.exit()
elif S[1].isupper():
    print("WA")
    sys.exit()
elif S[-1].isupper():
    print("WA")
    sys.exit()
elif "C" in S[2:-1]:
    S.remove("C")
    del S[0]
    S = str(S)
    if S.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
s = input()
ans = "AC"
if s[0] != 'A':
    ans = "WA"
s = list(s)
s[0] = 'a'
f = 0
for i in range(2,len(s)-1):
    if s[i] == "C":
        if f:
            ans = "WA"
        else:
            f = 1
            s[i] = "c"

if not f:
    ans = "WA"
for si in s:
    if si not in "abcdefghijklmnopqrstuvwxyz":
        print(si, 1)
        ans = "WA"
print(ans)


Fixed code:

s = input()
ans = "AC"
if s[0] != 'A':
    ans = "WA"
s = list(s)
s[0] = 'a'
f = 0
for i in range(2,len(s)-1):
    if s[i] == "C":
        if f:
            ans = "WA"
        else:
            f = 1
            s[i] = "c"

if not f:
    ans = "WA"
for si in s:
    if si not in "abcdefghijklmnopqrstuvwxyz":
        ans = "WA"
print(ans)
Buggy code:
s = input()

if s[0] == 'A' and 'C' in s[2:-2] and s[1:].replace('C', '').islower():
    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:
# ABC104B - AcCepted
s = input().rstrip()
if (
    s[0] == "A"
    and s[2:-1].count("C") == 1
    and s.translate(str.maketrans({"A": None, "C": None}).islower()
):
    print("AC")
else:
    print("WA")

Fixed code:
# ABC104B - AcCepted
s = input().rstrip()
if (
    s[0] == "A"
    and s[2:-1].count("C") == 1
    and s.translate(str.maketrans({"A": None, "C": None})).islower()
):
    print("AC")
else:
    print("WA")
Buggy code:
s = input()
ans = "WA"
tmp =""
if s[0] == 'A':
    if s[2:-1].count("C") ==1:
        tmp = s.replace("A","a").replace("C."c)
        if tmp = s.lower():
            ans = "AC"
print(ans)

Fixed code:
s = input()
ans = "WA"
tmp =""
if s[0] == 'A':
    if s[2:-1].count("C") ==1:
        tmp = s.replace("A","a").replace("C","c")
        if tmp == s.lower():
            ans = "AC"
print(ans)
Buggy code:
import sys

s = input()

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

if s[1] < "a" or s[1] > "z":
    print("WA")
    sys.exit(1)


sub = s[2:-1]
has = False
for c in sub:
    if not has and c == "C":
        has = True

    elif "a" <= c <= "z":
        continue

    else:
        has = False
        break

if not has:
    print("wA")
    sys.exit(0)

if "a" <= s[len(s) - 1] <= "z":
    print("AC")
else:
    print("WA")


Fixed code:
import sys

s = input()

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

if s[1] < "a" or s[1] > "z":
    print("WA")
    sys.exit(0)


sub = s[2:-1]
has = False
for c in sub:
    if not has and c == "C":
        has = True

    elif "a" <= c <= "z":
        continue

    else:
        has = False
        break

if not has:
    print("WA")
    sys.exit(0)

if "a" <= s[-1] <= "z":
    print("AC")
else:
    print("WA")
Buggy code:
s = input()
print("AC" if s[0] == "A" and s[2:len(s)-1].count("C") == 1 and s.replace("C","",1).islower() else "WA")

Fixed code:
s = input()
print("AC" if s[0] == "A" and s[2:len(s)-1].count("C") == 1 and s[1:].replace("C","",1).islower() else "WA")
Buggy code:
s = input()
ans = "AC"
if s[0] != 'A':
    ans = "WA"
cnt = 0
for i in range(len(s)):
    if s[i].isupper():
        if i == 1 or i!='C' or i==len(s)-1:
            ans = "WA"
        cnt+=1
if cnt!=1:
    ans="WA"
print(ans)


Fixed code:
s = input()
ans = "AC"
if s[0] != 'A':
    ans = "WA"
cnt = 0
for i in range(1,len(s)):
    if s[i].isupper():
        if i == 1 or s[i]!= "C" or i==len(s)-1:
            ans = "WA"
        cnt+=1
if cnt!=1:
    ans="WA"
print(ans)
Buggy code:
S = input()
if S[0] == 'A' and S[2:-1].count('C')==1 and sum([for c in S c.isupper()])==2 :
  print('AC')
else:
  print('WA')

Fixed code:
S = input()
if S[0] == 'A' and S[2:-1].count('C')==1 and sum([c.isupper() for c in S])==2 :
  print('AC')
else:
  print('WA')
Buggy code:
import re
s = input()
print("AC" if re.match(r'^A[a-z][a-z]*C[a-z]*[a-z]',s) else "WA")

Fixed code:
import re
s = input()
print("AC" if re.match(r'^A[a-z][a-z]*C[a-z]*[a-z]$',s) else "WA")
Buggy code:
from collections import Counter
s=list(input())
k=0
if s[0]=='A':
    for i in range(2,len(s)-1):
        if s[i]=='C':
            k+=1
    if k==1:
        if s.replace('A', 'a').replace('C', 'c') == s.lower():print('AC')
        else:print('WA')
    else:print('WA')
else:print('WA')

Fixed code:
from collections import Counter
l=input()
s=list(l)
k=0
if s[0]=='A':
    for i in range(2,len(s)-1):
        if s[i]=='C':
            k+=1
    if k==1:
        if l.replace('A', 'a').replace('C', 'c') == l.lower():print('AC')
        else:print('WA')
    else:print('WA')
else:print('WA')
Buggy code:
s = input()
t = s.replace('A','c').replace('C','c')
if s[0]!='A' or 'C' not in s[1:len(s)-1] or s[1:len(s)-1].count('C') != 1 or t != t.lower():
    print('WA')
else:
    print('AC')

Fixed code:
s = input()
t = s.replace('A','c').replace('C','c')
if s[0]!='A' or 'C' not in s[2:len(s)-1] or s[2:len(s)-1].count('C') != 1 or t != t.lower():
    print('WA')
else:
    print('AC')
Buggy code:
S=input()
flag=True
if S[0]=="A":
    if S[2:-1].count("C")==1:
        S=S.replace('A','').replace('C','')
        if S==S.lower():
            flag=True
        else:
            flag=False
    else:
        flag=false
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')

Fixed code:
S=input()
flag=True
if S[0]=="A":
    if S[2:-1].count("C")==1:
        S=S.replace('A','').replace('C','')
        if S==S.lower():
            flag=True
        else:
            flag=False
    else:
        flag=False
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')
Buggy code:
s=list(input())
if s[0]!='A':
  print("WA")
elseif s[2:len(s)-1].count("C")!=1:
  print('WA')
else:
  s.remove('A')
  s.remove('C')
  ns=str(s)
  if ns.islower():
    print("AC")
  else:
    print("WA")
  

Fixed code:
s=list(input())
if s[0]!='A':
  print("WA")
elif s[2:len(s)-1].count("C")!=1:
  print('WA')
else:
  s.remove('A')
  s.remove('C')
  ns=str(s)
  if ns.islower():
    print("AC")
  else:
    print("WA")
Buggy code:
S=input()

judge = "AC" if (S[0] == 'a' and S[2:-1].count('C') == 1 and S[1:].replace('C', '').islower()) else "WA"
print(judge)

Fixed code:
S=input()

judge = "AC" if (S[0] == 'A' and S[2:-1].count('C') == 1 and S[1:].replace('C', '').islower()) else "WA"
print(judge)
Buggy code:
import re
s = input()
ci = s.index("C")
if s.index("A") == 0 and 2 <= ci < len(s) - 2:
  tmp = list(s)
  del tmp[0]
  del tmp[ci]
  if re.match("^[a-z]*$", "".join(tmp)):
    print("AC")
    exit()
print("WA")

Fixed code:
import re
s = input()
ci = s.find("C")
if s.find("A") == 0 and 2 <= ci <= len(s) - 2:
  tmp = list(s)
  del tmp[0]
  del tmp[ci - 1]
  if re.match("^[a-z]*$", "".join(tmp)):
    print("AC")
    exit()
print("WA")
Buggy code:
s = input()
s_2 = s[2:-1]
s_3 = s[:2] + s_2.replace("C", "") + s[-1]
s_3 = s_3.replace("A", "", 1)
print(s_3)
if s[0] == "A" and s_2.count("C") == 1 and s_3.islower():
  print("AC")
else:
  print("WA")

Fixed code:
s = input()
s_2 = s[2:-1]
s_3 = s[:2] + s_2.replace("C", "") + s[-1]
s_3 = s_3.replace("A", "", 1)
if s[0] == "A" and s_2.count("C") == 1 and s_3.islower():
  print("AC")
else:
  print("WA")
Buggy code:
AC = input()
correct = AC[0] == 'A' and AC.count('A') == 1 and AC[-1] != 'C' and AC[:2].count('C') == 0 and AC[2:-1].count('C') and AC.replace('A', 'a').replace('C', 'c') == AC.lower()
print('AC' if correct else 'WA')

Fixed code:
AC = input()
correct = AC[0] == 'A' and AC.count('A') == 1 and AC[-1] != 'C' and AC[:2].count('C') == 0 and AC[2:-1].count('C') == 1 and AC.replace('A', 'a').replace('C', 'c') == AC.lower()
print('AC' if correct else 'WA')
Buggy code:
S = input()
S = list(S)
flag = True
if S[0] != "A":
    flag = False
flag1 = False
for i in range(3,len(S)-1):
    if S[i] == "C" and flag1:
        flag = False
        S[i] = 'c'
        
    elif S[i] == "C" and not flag1:
        flag1 = True
if not flag1:
    flag = False
S[0] = "a"
for i in range(len(S)):
    if not S[i].islower():
        flag = False
        
if flag:
    print('AC')
else:
    print('WA')

Fixed code:
S = input()
S = list(S)
flag = True
if S[0] != "A":
    flag = False
flag1 = False
for i in range(2,len(S)-1):
    if S[i] == "C" and flag1:
        flag = False
        
        
    elif S[i] == "C" and not flag1:
        flag1 = True
        S[i] = "c"
if not flag1:
    flag = False
S[0] = "a"
for i in range(len(S)):
    if not S[i].islower():
        flag = False
        
if flag:
    print('AC')
else:
    print('WA')
Buggy code:
S = list(input())

ans = "AC"

if S[0] != "A":
  ans = "WA"
  
count = 0
for item in S[2:-2]:
  if item == "C":
    count += 1
    
if count != 1:
  ans = "WA"
  
S.remove("A")
S.remove("C")

if "".join(S).lower() != "".join(S):
  ans = "WA"

print(ans)

Fixed code:
S = list(input())

ans = "AC"
tmp = S[2:-1]

if S[0] != "A":
  ans = "WA"
else:
  S.remove("A")
  
count = 0
for item in tmp:
  if item == "C":
    count += 1
    
if count != 1:
  ans = "WA"
elif count == 1:
  S.remove("C")


if "".join(S).lower() != "".join(S):
  ans = "WA"

print(ans)
Buggy code:
s = input()
n = len(s)

if s[0] != "A" or s[1].isupper() or s[2:].count("C") != 1:
    print("WA")
    exit()

for i in range(n):
    if s[i] == "C":
        s1 = s[1:i] + s[i+1:]

if s1.islower():
    print("AC")
else:
    print("WA")
    exit()

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

if s[0] != "A" or s[1].isupper() or s[n-1] == "C" or s[2:].count("C") != 1:
    print("WA")
    exit()

for i in range(n):
    if s[i] == "C":
        s1 = s[1:i] + s[i+1:]

if s1.islower():
    print("AC")
else:
    print("WA")
    exit()
Buggy code:
#B AcCepted
b = input()
a = list(b)
c=z = len(b)
d =""
if a[0] == "A":
    a[0] = "a"
    c = 10000
for i in range(2,c):
    if a[i] == "C":
        a[i]="c"
        c+=1
for i in a:
    d+=i
if d.islower() and c == 10001:
    print("AC")
else:
    print("WA")
    
    

Fixed code:
#B AcCepted
b = input()
a = list(b)
c=z = len(b)
d =""
if a[0] == "A":
    a[0] = "a"
    c = 10000
for i in range(2,z-1):
    if a[i] == "C":
        a[i]="c"
        c+=1
for i in a:
    d+=i
if d.islower() and c == 10001:
    print("AC")
else:
    print("WA")