qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s=input()
ans="AC"
cnt1=0
cnt2=0
cnt3=0
for i in range(len(s)):
    if i==0:
        if s[i]!="A":
            ans="WA"
    if i==1:
        cnt1+=s[i].isupper()*1
    if i>=2:
        if i==len(s)-1:
            if s[i]=="C":
                ans="WA"
        elif s[i]=="C":
            cnt2+=1
        else:
            cnt3+=s[i].isupper()*1
if cnt1!=0 or cnt2!=1 or cnt!=0:
    ans="WA"
print(ans)

Fixed code:
s=input()
ans="AC"
cnt1=0
cnt2=0
cnt3=0
for i in range(len(s)):
    if i==0:
        if s[i]!="A":
            ans="WA"
    if i==1:
        cnt1+=s[i].isupper()*1
    if i>=2:
        if i==len(s)-1:
            if s[i]=="C":
                ans="WA"
            elif s[i].isupper()*1>0:
                ans="WA"
        elif s[i]=="C":
            cnt2+=1
        else:
            cnt3+=s[i].isupper()*1
if cnt1!=0 or cnt2!=1 or cnt3!=0:
    ans="WA"
print(ans)
Buggy code:
sml='Cqwertyuiopasdfghjklzxcvbnm'

s=input()
n=len(s)
if s[0]=='A' and s[2:n].count('C')==1 and set(s[1:])<=set(sml):
  print('AC')
else:
  print('WA')

Fixed code:
sml='Cqwertyuiopasdfghjklzxcvbnm'

s=input()
n=len(s)
if s[0]=='A' and s[2:n-1].count('C')==1 and set(s[1:])<=set(sml):
  print('AC')
else:
  print('WA')
Buggy code:
s = input()

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

Fixed code:
s = input()
ans = "WA"
if s[0] == "A":
    if s[2:-1].count("C") == 1:
        a = s.index("C")
        if s[1:a].islower() and s[a+1:].islower() :
            ans = "AC"
print(ans)
Buggy code:
s = input()
ans = "AC"
if s[0] == "A":
  c_cnt = 0
  for i in range(2,len(s)-1):
    if s[i] == "C":
      c_cnt += 1
  if c_cnt = 1:
    for i in s:
      if i.lower() != "a" and i.lower() != "c" and i.lower() != i:
        ans = "WA"
        break
  else:
    ans = "WA"
else:
  ans = "WA"
print(ans)

Fixed code:
s = input()
ans = "AC"
if s[0] == "A":
  c_cnt = 0
  for i in range(2,len(s)-1):
    if s[i] == "C":
      c_cnt += 1
  if c_cnt == 1:
    for i in s:
      if i.lower() != "a" and i.lower() != "c" and i.lower() != i:
        ans = "WA"
        break
  else:
    ans = "WA"
else:
  ans = "WA"
print(ans)
Buggy code:
import sys


def main():
    s = list(input())
    if s[0] != 'A' and s[2:-1].count("C") != 1:
        print("WA")
    else:
        for i in range(1, len(s)):
            if ord(s[i]) < ord('a') and i != s.index('C'):
                print("WA")
                sys.exit(0)
        print("AC")


if __name__ == "__main__":
    main()


Fixed code:
import sys


def main():
    s = list(input())
    if s[0] != 'A' or s[2:-1].count("C") != 1:
        print("WA")
    else:
        for i in range(1, len(s)):
            if ord(s[i]) < ord('a') and i != s.index('C'):
                print("WA")
                sys.exit(0)
        print("AC")


if __name__ == "__main__":
    main()
Buggy code:
S = input()
if S[0] == "A" and (S[2: -2].count("C") == 1):
  for c in S:
    if c != "A" and c != "C" and c.isupper():
      print("WA")
      exit(0)
print("AC")
    

Fixed code:
S = input()
if S[0] == "A" and (S[2: -1].count("C") == 1):
  for c in S:
    if c != "A" and c != "C" and c.isupper():
      print("WA")
      exit(0)
  print("AC")
else:
  print("WA")
Buggy code:
import re
S=input()
if S[0]=="A" and S[2:-1].count("C")==1 and len(re.findall("[A-Z]")):
  print("AC")
else:
  print("WA")


Fixed code:
import re
S=input()
if S[0]=="A" and S[2:-1].count("C")==1 and len(re.findall("[A-Z]",S))==2:
  print("AC")
else:
  print("WA")
Buggy code:
# -*- coding: utf-8 -*-
s = input()

flag = True

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

if "C" not in s[2:-1]:
    print("WA")
    exit()

idx = s[2:-1].find("C")+2

s = s[1:idx]+s[idx+1:]

if s == s.lower():
    print("AC")
else:
    print("WC")


Fixed code:
# -*- coding: utf-8 -*-
s = input()

flag = True

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

if "C" not in s[2:-1]:
    print("WA")
    exit()

idx = s[2:-1].find("C")+2

s = s[1:idx]+s[idx+1:]

if s == s.lower():
    print("AC")
else:
    print("WA")
Buggy code:
s = input()


def check(w):
    if w[0] != 'A':
        return False
    n = len(w)
    count = 0
    for a in range(2, n):
        if w[a] == 'C':
            count += 1
    if count != 1:
        return False
    upper = 0
    for a in range(0, n):
        if w[a] >= 'A' and w[a] <= 'Z':
            upper += 1

    if upper != 2:
        return False
    return True

if check(s):
    print('AC')
else:
    print('WA')

Fixed code:
s = input()


def check(w):
    if w[0] != 'A':
        return False
    n = len(w)
    count = 0
    for a in range(2, n-1):
        if w[a] == 'C':
            count += 1
    if count != 1:
        return False
    upper = 0
    for a in range(0, n):
        if w[a] >= 'A' and w[a] <= 'Z':
            upper += 1

    if upper != 2:
        return False
    return True


if check(s):
    print('AC')
else:
    print('WA')
Buggy code:
A = list(input())
L = len(A)

ans = 'WA'
flag = 0
f = 0
j = 0

if A[0] == 'A':
    if A[0].isupper():
        flag = flag + 1
#print(flag)
count = 0
for i in range(2,L-2):
    if A[i] == 'C':
        if A[i].isupper():
            count = count + 1
           
#print(j)
if count == 1:
    flag = flag + 1
#print(flag)
count = 0
for i in range(1,L-1):
    print(A[i].isupper())
    if A[i].isupper():
        count = count + 1
#print(count)
if count == 1:
    flag = flag + 1
#print(flag)
if flag == 3:
    ans = 'AC'

print(ans)

Fixed code:
A = list(input())
L = len(A)

ans = 'WA'
flag = 0
f = 0
j = 0

if A[0] == 'A':
    if A[0].isupper():
        flag = flag + 1
#print(flag)
count = 0
i=2
while(1):
    if A[i] == 'C':
        if A[i].isupper():
            count = count + 1
    i = i + 1
    if (L-2-i < 0):
        break
#print(count)
if count == 1:
    flag = flag + 1
#print(flag)
count = 0
for i in range(1,L):
    #print(A[i].isupper())
    if A[i].isupper():
        count = count + 1
#print(count)
if count == 1:
    flag = flag + 1
#print(flag)
if flag == 3:
    ans = 'AC'

print(ans)
Buggy code:
S=input()
if S[0]=="A":
    if "C"in S[3:-1]:
        if S.count("C")==1:
            S.replace("A","")
            S.replace("C","")
            if S.islower():print("AC")
            else:print("WA")
        else:print("WA")
    else:print("WA")

else:print("WA")
            


Fixed code:
S=input()
if S[0]=="A":
    if "C"in S[2:-1]:
        if S[2:-1].count("C")==1:
            S=S.replace("A","")
            S=S.replace("C","")
            
            if S.islower():print("AC")
            else:print("WA")
        else:print("WA")
    else:print("WA")

else:print("WA")
Buggy code:
S = input()
l = len(S)
cnt = 0
cnt2 = 0
for i in range(l):
	if (S[i] != 'A' and i == 0):
		print("WA")
		exit(0)

	if (2 <= i and i < l and S[i] == 'C'):
		cnt += 1

	if S[i].isupper():
		cnt2 += 1


if (cnt != 1 or cnt2 != 2):
	print("WA")
	exit(0)

print("AC")


Fixed code:
S = input()
l = len(S)
cnt = 0
cnt2 = 0
for i in range(l):
	if (S[i] != 'A' and i == 0):
		print("WA")
		exit(0)

	if (2 <= i and i < l-1 and S[i] == 'C'):
		cnt += 1

	if S[i].isupper():
		cnt2 += 1


if (cnt != 1 or cnt2 != 2):
	print("WA")
	exit(0)

print("AC")
Buggy code:
s = str(input())
i = len(s)

sc = s.lstrip("A")
sb = sc.replace("C", "")

if s[0] == "A" and s[2:i - 1].count("C") == 1 and sb.islower() is True:
    print("AC")

else:
    print("WA")

print(sb)


Fixed code:
s = str(input())
i = len(s)

sc = s.lstrip("A")
sb = sc.replace("C", "")

if s[0] == "A" and s[2:i - 1].count("C") == 1 and sb.islower() is True:
    print("AC")

else:
    print("WA")
Buggy code:
a = input()
def atcoder(p):
    count = 0
    if p[0]=='A':
        count += 1
    
    count_C=0
    for i in range(len(p)-2):
        if p[i+2]=='C':
            count_C += 1
    if count_C == 1:
        count += 1
    
    count_c = 0
    for i in range(len(p)-1):
        if p[i].upper() ==p[i]:
            count_c+=1
    if p[len(p)-1]==p[len(p)-1].upper():
        count_c+=1
    if count_c ==2:
        count += 1
    
    if count ==3:
        print('AC')
    else:
        print('WA')
         
atcoder(a)

Fixed code:
a = input()
def atcoder(p):
    count = 0
    if p[0]=='A':
        count += 1
    
    count_C=0
    for i in range(len(p)-2):
        if p[i+2]=='C':
            count_C += 1
    if count_C == 1:
        count += 1
    
    count_c = 0
    for i in range(len(p)-1):
        if p[i].upper() ==p[i]:
            count_c+=1
    if p[len(p)-1]==p[len(p)-1].upper():
        count_c+=2
    if len(p)==3:
        count_c+=2
    if count_c ==2:
        count += 1
    
    
    if count ==3:
        print('AC')
    else:
        print('WA')
         
atcoder(a)
Buggy code:
S = input()
N = len(S)

cond1 = True if S[0] == 'A' else False
cond2 = True if S[3:-2].count('C') == 1 else False
cond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False

print('AC') if cond1 and cond2 and cond3 else print('WA')

Fixed code:
S = input()
N = len(S)
 
cond1 = True if S[0] == 'A' else False
cond2 = True if S[2:-1].count('C') == 1 else False
cond3 = True if sum(map(lambda x: x.islower(), S)) == N-2 else False
 
print('AC') if cond1 and cond2 and cond3 else print('WA')
Buggy code:
s = input()
print('AC' if s[1] == 'A' and 'C' in s[2:-1] and s[1:].replace('C','',1).islower() else 'WA')

Fixed code:
s = input()
print('AC' if s[0] == 'A' and 'C' in s[2:-1] and s[1:].replace('C','',1).islower() else 'WA')
Buggy code:
a=input();b=a[1:].replace('C','');print('WAAC'[a[0]=="A"and1==a[2:-1].count("C")and b.lower()==b::2])

Fixed code:
a=input();b=a[1:].replace('C','');print('WAAC'[a[0]=="A"and 1==a[2:-1].count("C")and b.lower()==b::2])
Buggy code:
S=input()
s=abcdefghijklmnopqrstuvwxyz
c=0
if S[0]=="A" and "C" in S[2:len(S-1)]:
  i=S.find("C")
  S=S[1:i]+S[i+1:]
  if S.islower():
    c=1
print("AC" if c==1 else "WA")

Fixed code:
S=input()
c=0
if S[0]=="A" and "C" in S[2:len(S)-1]:
  i=S.find("C")
  S=S[1:i]+S[i+1:]
  if S.islower():
    c=1
print("AC" if c==1 else "WA")
Buggy code:
def m():
    s = str(input())
    if s[0] != "A":
        return "WA"
    if s.count("C") != 1:
        return "WA"
    if s[2] != "C" or s[-2] != "C":
        return "WA"
    for c in s[1:]:
        if c == "C":
            continue
        if c.isupper():
            return "WA"
    return "AC"


print(m())


Fixed code:
def m():
    s = str(input())
    if s[0] != "A":
        return "WA"
    if s[2:len(s)-1].count("C") != 1:
        return "WA"
    for c in s[1:]:
        if c == "C":
            continue
        if c.isupper():
            return "WA"
    return "AC"


print(m())
Buggy code:
def solve(s):
	if s[0]!='A':
    	return 'WA'
    if s[3:len(s)-1].count('C')!=1:
    	return 'WA'
    s=s.split('A').split('C')
    if not s.islower():
    	return 'WA'
    return 'AC'
  
s=input()
print(solve())
    	

Fixed code:
def solve(s):
    if s[0]!='A':
        return 'WA'
    if s[2:len(s)-1].count('C')!=1:
        return 'WA'
    s=str(s.split('A'))
    s=str(s.split('C'))
    if not s.islower():
        return 'WA'
    return 'AC'

s=input()
print(solve(s))
Buggy code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = ns()
ok = False
if s.startswith("A"):
    if s[2:-1].count("C") == 1:
        ct = 0
        for c in s:
            if "a" <= c <= "z":
                ct += 1
        if ct == len(s)-2:
            ok = True
print("AC" if ok else "WA")


Fixed code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = ns().rstrip()
ok = False
if s.startswith("A"):
    if s[2:-1].count("C") == 1:
        ct = 0
        for c in s:
            if "a" <= c <= "z":
                ct += 1
        if ct == len(s)-2:
            ok = True
print("AC" if ok else "WA")
Buggy code:
S = input()
C_cnt = 0
if S[0] == 'A' and S[1].islower() and S[-1].islower():
    temp = S[2:len(S)]
    if temp.count('C') == 1:
        for t in temp:
            if t != "C" and t.isupper() == True:
                print("WA")
                exit()
        else:
            print("AC")
print("WA")


Fixed code:
S = input()
C_cnt = 0
if S[0] == 'A' and S[1].islower() and S[-1].islower():
    temp = S[2:len(S)]
    if temp.count('C') == 1:
        for t in temp:
            if t != "C" and t.isupper() == True:
                print("WA")
                exit()
        else:
            print("AC")
            exit()
print("WA")
Buggy code:
s=list(input())
fld="WA"
if s[0]=="A":
  if "C" in s[2:len(s)-1]:
    s.remove("A")
    s.remove("C")
    s=''.join(s)
    if s.islower()==True:
      flg="AC"

print(flg)

Fixed code:
s = list(input())
flg = 'WA'
if s[0] == 'A':
    if 'C'in s[2:len(s)-1]:
        s.remove('A')
        s.remove('C')
        s = ''.join(s)
        if s.islower() == True:
            flg = 'AC'
print(flg)
Buggy code:
def main():
    S = input()

    if S[0] == 'A':
        count = 0
        for i in range(2, 2+len(S[2:-2])):
            if S[i] == 'C':
                count += 1
                index = i
        if count == 1:
            S = S[1:index]+S[index+1:]
            print(S)
            if S.islower():
                print('AC')
                return
    print('WA')


if __name__ == '__main__':
    main()


Fixed code:
def main():
    S = input()

    if S[0] == 'A':
        count = 0
        for i in range(2, 2+len(S[2:-1])):
            if S[i] == 'C':
                count += 1
                index = i
        if count == 1:
            S = S[1:index]+S[index+1:]
            if S.islower():
                print('AC')
                return
    print('WA')


if __name__ == '__main__':
    main()
Buggy code:
import copy

s = list(input())
s_t = copy.deepcopy(s)
##if s[0] =="A" and "C" in s[2:-2]:
#    if
counter = 0
 
if s[0] != "A":
    print("WA")
    exit()
 
c = False
komojo = True

for i in range(len(s)):
    if  2 <= i <= len(s)-2:
        if s[i] == "C":
            c = True
            #continue
        elif not s[i].islower():
            komojo = False

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




Fixed code:
import copy

s = list(input())
s_t = copy.deepcopy(s)
##if s[0] =="A" and "C" in s[2:-2]:
#    if
counter = 0
 
if s[0] != "A":
    print("WA")
    exit()
 
if not "C" in s[2:-1]:
    print("WA")
    exit()
 

c = False
komojo = True

for i in range(len(s)):
    if  2 <= i <= len(s)-2:
        if s[i] == "C":
            if c == True:
                print("WA")
                exit()
            elif c != True:
                c = True
            #continue
        elif not s[i].islower():
            komojo = False
    elif i != 0 and not s[i].islower():
        komojo = False
        

if c and komojo:
    print("AC")
else:
    print("WA")
Buggy code:
n=input()
wa=0
#print(n[2:len(n)-1])
if n[0]=="A" and n[2:len(n)-1].count("C")==1 and n[1]!="C" and n[len(n)]!="C":
    wa+=0
    import re
    a=re.sub('[AC ]', '',n)
else:
    wa+=1
    a=n
for i in range(len(a)):
    if 0<= ord(a[i]) - ord('a') <= 26:
        wa+=0
    else:
        wa+=1
if wa==0:
    print("AC")
else:
    print("WA")

Fixed code:
n=input()
wa=0
#print(n[2:len(n)-1])
#print(n[len(n)])
if n[0]=="A" and n[2:len(n)-1].count("C")==1 and n[1]!="C" and n[len(n)-1]!="C":
    wa+=0
    import re
    a=re.sub('[AC ]', '',n)
else:
    wa+=1
    a=n
for i in range(len(a)):
    if 0<= ord(a[i]) - ord('a') <= 26:
        wa+=0
    else:
        wa+=1
if wa==0:
    print("AC")
else:
    print("WA")
Buggy code:
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper()
  print("WA")
  sys.exit()
for i in range(1,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt = 1 and low = len(S)-3 and upp = 0:
  print("AC")
else :
  print("WA")

Fixed code:
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper() or S[1].isupper():
  print("WA")
  sys.exit()
for i in range(2,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt == 1 and low == len(S)-4 and upp == 0:
  print("AC")
else :
  print("WA")
Buggy code:
word=input()
cflg=True
if word[0]!=A:
  cflg=False
elif word[2:-2].count('C'):
  cflg=False
cnt=0
for l in word[1:-1]:
  if l.isupper():
    cnt+=1
else:
  if cnt!=1:
    cflg=False
  
if cflg:
  print('AC')
else:
  print('WC')

Fixed code:
word=input()
cflg=True
if word[0]!='A':
  cflg=False
elif word[2:-1].count('C')!=1:
  cflg=False
cnt=0
for l in word[1:]:
  if l.isupper():
    cnt+=1
else:
  if cnt!=1:
    cflg=False
  
if cflg:
  print('AC')
else:
  print('WA')
Buggy code:
s=input()
ans="AC"
if s[0]!="A":
    ans="WA"
c=0
idx=0
for i in range(2,len(s)-2):
    if s[i]=="C":
        c+=1
        idx=i
if c!=1:
    ans="WA"
small={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
for i in range(1,len(s)+1):
    if i!=idx:
        if s[i] not in small:
            ans="WA"
            break
print(ans)


Fixed code:
s=input()
ans="AC"
if s[0]!="A":
    ans="WA"
c=0
idx=0
for i in range(2,len(s)-1):
    if s[i]=="C":
        c+=1
        idx=i
if c!=1:
    ans="WA"
small={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
for i in range(1,len(s)):
    if i!=idx:
        if s[i] not in small:
            ans="WA"
            break
print(ans)
Buggy code:
s = input()
for c in s:
  if c.isupper():
    count += 1

if count == 2 and s[0] == 'A' and 'C' in s[2:-1]:
  print('AC')
else:
  print('WA')

Fixed code:
s = input()
count = 0
for c in s:
  if c.isupper():
    count += 1

if count == 2 and s[0] == 'A' and 'C' in s[2:-1]:
  print('AC')
else:
  print('WA')
Buggy code:
S = list(input())

s = S[2:-1]
s_sub = []
cnt = 0
for i in s:
  if (i == 'C'):
    cnt += 1

for i in s:
  if (i != 'A' or i != 'C'):
    s_sub.append(i)
 
    
if (S[0] == 'A' and cnt == 1 and "".join(s_sub).islower()):
  print('AC')
else:
  print('WA')


Fixed code:
S = list(input())

s = S[2:-1]
s_sub = []
cnt = 0
for i in s:
  if (i == 'C'):
    cnt += 1

for i in S[1:]:
  if (i != 'C'):
    s_sub.append(i)
if (S[0] == 'A' and cnt == 1 and "".join(s_sub).islower()):
  print('AC')
else:
  print('WA')
Buggy code:
s=list(str(input()))
n=len(s)
t=True
c=0
for i in range(n):
    if i == 0:
        if s[i]=="A":
            t=t and True
        else:
            t=False
    elif i == 1:
        if s[i]>="a" and s[i]<="z":
            t=t and True
        else:
            t = False
    else:
        if s[i] == "C":
            c+=1
        elif s[i]>="a" and s[i]<="z":
            t=t and True
        else:
            t = False
if c==1:
    t=t and True
else:
    t=False
if t:
    print("AC")
else:
    print("WA")
    

Fixed code:
s=list(str(input()))
n=len(s)
t=True
c=0
for i in range(n):
    if i == 0:
        if s[i]=="A":
            t=t and True
        else:
            t=False
    elif i == 1:
        if s[i]>="a" and s[i]<="z":
            t=t and True
        else:
            t = False
    else:
        if i!=n-1 and s[i] == "C":
            c+=1
        elif s[i]>="a" and s[i]<="z":
            t=t and True
        else:
            t = False
if c==1:
    t=t and True
else:
    t=False
if t:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()

countA = 0
countC = 0
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            print('WA')
            quit()
        else:
            continue
    if S[i] == 'A':
        countA += 1
    elif S[i] == 'C':
        if i < 2 or i == len(S)-1:
            print('WA')
            quit()
        countC += 1
    elif not S[i].islower():
        print('WA')
        quit()
    if countA > 1 or countC > 1:
        print('WA')
        quit()

if countA != 1 or countC != 1:
    print('WA')
    quit()
print('AC')

Fixed code:
S = input()

countA = 0
countC = 0
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            print('WA')
            quit()
        else:
            countA += 1
            continue
    if S[i] == 'C':
        if i < 2 or i == len(S)-1:
            print('WA')
            quit()
        countC += 1
    elif not S[i].islower():
        print('WA')
        quit()
    if countA > 1 or countC > 1:
        print('WA')
        quit()

if countA != 1 or countC != 1:
    print('WA')
    quit()
print('AC')
Buggy code:
import re
ans=re.match("^A[a-z]+C[a-z]+",input())
print("AC" if ans else "WA")

Fixed code:
import re
ans=re.match("^A[a-z]+C[a-z]+$",input())
print("AC" if ans else "WA")
Buggy code:
S = list(input())
C = S[2:-1]
if S[0] == "A" and "C" in C and C.count("C") == 1:
    S.remove("A")
    S.remove("C")
    print(S)
    T="".join(S)
    print(T)
    Y=T.lower()
    if T == Y:
        print("AC")
    else:
        print("WA")
else:
    print("WA")


Fixed code:
S = list(input())
C = S[2:-1]
if S[0] == "A" and "C" in C and C.count("C") == 1:
    S.remove("A")
    S.remove("C")
    T="".join(S)
    Y=T.lower()
    if T == Y:
        print("AC")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
S = input()
if S[0] == "A" and "C" in S[2:-1]:
  a = list(S)
  a.remove("A")
  a.remove("C")
  count = 0
  if len(a) == len(S) - 2:
    for i in range(len(a)):
      if a[i].islower:
        count += 1
        if count == len(a):
          ans = "AC"
else:
  ans = "WA"

print(ans)

Fixed code:
S = input()
if S[0] == "A" and "C" in S[2:-1]:
  a = list(S)
  a.remove("A")
  a.remove("C")
  count = 0
  for i in range(len(a)):
    if a[i].islower():
      count += 1
  if count == len(a):
    ans = "AC"
  else:
    ans = "WA"
else:
  ans = "WA"

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

if re.fullmatch(r'A[a-z]+C[a-z]+', S):
    print('AC')
else:
    print('WA')

Fixed code:
import re
S = input()

if re.fullmatch(r'A[a-z]+C[a-z]+', S):
    print('AC')
else:
    print('WA')
Buggy code:
s=input()
print("AC" if s[0]=="A" and "C" in s[1:-2] and s[1:].replace("C","",1).islower() else "WA")

Fixed code:
s=input()
print("AC" if s[0]=="A" and "C" in s[2:-1] and s[1:].replace("C","",1).islower() else "WA")
Buggy code:
import re
s = input()
matchOB = re.match(r'A[a-z]+C[a-z]+', s)
if matchOB:
  print('AC')
else:
  print('WA')

Fixed code:
import re
s = input()
matchOB = re.match(r'^A[a-z]+C[a-z]+$', s)
if matchOB:
  print('AC')
else:
  print('WA')
Buggy code:
S = input()
flag = True
if S[0] != 'A' or S[2:-2].count('C') != 1 or S[1].lower() != S[1] or S[-1].lower() != S[-1]:
  flag = False
for i in range(2,len(S)-1):
  if s != 'C' and s.lower() != s:
    flag = False
print('AC' if flag else 'WA')

Fixed code:
S = input()
flag = True
if S[0] != 'A' or S[2:-1].count('C') != 1 or S[1].lower() != S[1] or S[-1].lower() != S[-1]:
  flag = False
for i in range(2,len(S)-1):
  if S[i] != 'C' and S[i].lower() != S[i]:
    flag = False
print('AC' if flag else 'WA')
Buggy code:
s = input()

wa = False

if s[0] != 'A':
  wa = True

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

l_s = list(s)
  
del l_s[l_s.index('A')]
del l_s[l_s.index('C')]

for c in l_s:
  if c != c.lower():
    wa = True
    
if wa == True:
  print('WA')
else:
  print('AC')

Fixed code:
s = input()

wa = False

if s[0] != 'A':
  wa = True
if s[2:-1].count('C') != 1:
  wa = True

l_s = list(s)
  
if 'A' in l_s:
	del l_s[l_s.index('A')]

if 'C' in l_s:
	del l_s[l_s.index('C')]

for c in l_s:
  if c != c.lower():
    wa = True
    
if wa == True:
  print('WA')
else:
  print('AC')