qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    print('AC' if 'A' == S[0] and 'C' in S[2:-1] and S[1:].replace('C', '', 1).islower else 'WA')


if __name__ == '__main__':
    main()


Fixed code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = iss()
    if S[0] == 'A' and S[2:-1].count('C') == 1:
        for s in list(S):
            if s != 'A' and s != 'C' and str.isupper(s):
                print('WA')
                exit()
        else:
            print('AC')
    else:
        print('WA')


if __name__ == '__main__':
    main()
Buggy code:
#!/usr/bin/env python3
#ABC104 B

alpha = "BDEFGHIJKLMNOPQRSTUVWXYZ"
s = list(input())
if s[0] != 'A':
    print('WA')
    quit()
if s[2:-1].count('C')!= 1:
    print('WA')
    quit()
for i in range(len(s)):
    if s[i] in alpha:
        print('WA')
        quit()
    elif s[i] == 'A':
        if i != 0:
            print('WA')
            quit()
    elif s[i] == 'C':
        if 0 <= i < 3 or i == len(s)-1:
            print('WA')
            quit()
print('AC')


Fixed code:
#!/usr/bin/env python3
#ABC104 B

alpha = "BDEFGHIJKLMNOPQRSTUVWXYZ"
s = list(input())
if s[0] != 'A':
    print('WA')
    quit()
if s[2:-1].count('C')!= 1:
    print('WA')
    quit()
for i in range(len(s)):
    if s[i] in alpha:
        print('WA')
        quit()
    elif s[i] == 'A':
        if i != 0:
            print('WA')
            quit()
    elif s[i] == 'C':
        if 0 <= i < 2 or i == len(s)-1:
            print('WA')
            quit()
print('AC')
Buggy code:
a=input()
b=a[1:].replace("C","")
c=b.lower()
print(["WA","AC"][a[0]=="A" and a[2:-2].count("C")==1 and b==c])

Fixed code:
a=input()
b=a[1:].replace("C","")
c=b.lower()
print(["WA","AC"][a[0]=="A" and a[2:-1].count("C")==1 and b==c])
Buggy code:
s = str(input())
if s[0] != "A":
    print("WA")
    exit()
cou = 0
for i in range(1,len(s)):
    num = ord(s[i])-ord("a")
    if 0 <= num and num <= 25:
        continue
    else:
        if s[i] == "C":
            if i == 1 or i == len(s)-1:
                print("WA")
                exit()
            else:
                cou += 1
        else:
            print("WA")
            exit()
    if cou > 1:
        print("WA")
        exit()
print("AC")

Fixed code:
s = str(input())
if s[0] != "A":
    print("WA")
    exit()
cou = 0
for i in range(1,len(s)):
    num = ord(s[i])-ord("a")
    if 0 <= num and num <= 25:
        continue
    else:
        if s[i] == "C":
            if i == 1 or i == len(s)-1:
                print("WA")
                exit()
            else:
                cou += 1
        else:
            print("WA")
            exit()
if cou == 1:
    print("AC")
else:
    print("WA")
Buggy code:
import re
s = input()
print('AC' if re.match('^A[a-z]C[a-z]+', s) else 'WA')

Fixed code:
import re
s = input()
print('AC' if re.match('A[a-z]+C[a-z]+$', s) else 'WA')
Buggy code:
S = [i for i in input()]
if S[0]=="A":
    if S[3:-2].count("C")==1:
        S.remove("A")
        S.remove("C")
        if "".join(S).islower():
            print("AC")
        else:
            print("WA")
    print("WA")
print("WA")

Fixed code:
S = [i for i in 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:
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":
    if S[2:-1].count("C") == 1:
        idx = S[2:-1].index("C") + 2
        S = S[1:idx] + S[idx+1:]
        if S == S.lower():
            print("AC")

print("WA")

Fixed code:
S = input()

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

print("WA")
Buggy code:
str=list(input())

count1=0
count2=0
if str[0]=="A":
  for i in range(len(str)-3):
    if str[i+2]=="C":
      count1 += 1
  for i in range(len(str)):
    if str[i]==str[i].capitalize():
      count2 += 1
  if count1 == 1 && count2 !=0 :
    print("AC")
  else:
    print("WA")
else:
  print("WA")
    
    
  
  

Fixed code:
str=list(input())

count1=0
count2=0
if str[0]=="A":
  for i in range(len(str)-3):
    if str[i+2]=="C":
      count1 += 1
  for i in range(len(str)):
    if str[i]==str[i].capitalize():
      count2 += 1
  if count1 == 1 and count2 ==2 :
    print("AC")
  else:
    print("WA")
else:
  print("WA")
Buggy code:
S = input()
flag = True
count = 0
if not S[0] == "A":
  flag = False
for i in range(2,len(S)-1):
  if S[i] == "C":
    count += 1
  else:
    if not S[len(S)].islower():
      flag = False 
if not S[len(S)].islower():
  flag = False
if not count == 1:
  flag = False
if flag:
  print("AC")
else:
  print("WA")

Fixed code:
S = input()
flag = True
count = 0
if not S[0] == "A":
  flag = False
for i in range(2,len(S)-1):
  if S[i] == "C":
    count += 1
  else:
    if not S[i].islower():
      flag = False
if not S[1].islower():
  flag = False
if not S[len(S)-1].islower():
  flag = False
if not count == 1:
  flag = False
if flag:
  print("AC")
else:
  print("WA")
Buggy code:
import sys
input = sys.stdin.readline

S = input().rstrip()
trimed_S = S[3:-2].replace('C', '', 1)

ans = 'AC'
if S[0] != 'A':
  ans = 'WA'
elif not trimed_S.islower() or len(S) - len(trimed_S) != 1:
  ans = 'WA'

print(ans)


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

S = input().rstrip()
S32 = S[2:-1]
trimed_S = S32.replace('C', '', 1)
ac_cut_S = S.replace('A', '', 1).replace('C', '', 1)

ans = 'AC'
if S[0] != 'A':
  ans = 'WA'
elif (not ac_cut_S.islower()) or len(S32) - len(trimed_S) != 1:
  ans = 'WA'

print(ans)
Buggy code:
s = list(input())

if s[0] == "A" and s[2:-1].count("C") == 1:
    s.remove("C")
    s.pop(0)
    print(s)
    s_ = "".join(s)
    if s_.islower() == True:
        print("AC")
        exit()
print("WA")

Fixed code:
s = list(input())
 
if s[0] == "A" and s[2:-1].count("C") == 1:
    s.remove("C")
    s.pop(0)
    s_ = "".join(s)
    if s_.islower() == True:
        print("AC")
        exit()
print("WA")
Buggy code:
s = input()
flag = True
if(s[0] != 'A'):
    flag = False
if(s[-1] == 'C' or s[1] == 'C'):
    flag = False
if(s.count('C') == 0 or s.count('C') >= 2):
    flag = False
if (s.count('A') == 0 or s.count('A') >= 2):
    flag = False
for i in s:
    if(i != 'A' or i != 'C' or s - 'A' >= 0):
        flag = False
if(flag):
    print("AC")
else:
    print("WA")


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

def AcCepted(s):

    ans = "WA"

    if s[0] == "A" and s[1:-2].count("C") == 1:
        s = s.replace("C" , "c")
        if s[1:].islower():
            ans = "AC"

    return ans

def main():
    s = str(input())
    print(AcCepted(s))

if __name__ == '__main__':
    main()

Fixed code:

def AcCepted(s):

    ans = "WA"

    if s[0] == "A" and s[2:-1].count("C") == 1:
        s = s.replace("C" , "c")
        if s[1:].islower():
            ans = "AC"

    return ans

def main():
    s = str(input())
    print(AcCepted(s))

if __name__ == '__main__':
    main()
Buggy code:
def piyo():
    s = list(str(input()))
    c = 0
    if s[0]!="A":
        return "WA"
    if s[0]=="C" and s[1]=="C" and s[2]=="C" and s[len(s)-2]=="C" and s[len(s)-1]=="C":
        return "WA"
    for hage in s:
        if hage!="A" and hage!="C":
            if hage.isupper():
                return "WA"
        if hage=="C":
            c+=1
    if c>1:
        return "WA"
    return "AC"
        
if __name__ == '__main__':
    hoge=piyo()
    print(hoge)

Fixed code:
def piyo():
    s = list(str(input()))
    c = 0
    a = 0
    if s[0]!="A":
        return "WA"
    if s[1]=="C" or s[len(s)-1]=="C":
        return "WA"
    for hage in s:
        if hage!="A" and hage!="C":
            if hage.isupper():
                return "WA"
        if hage=="C":
            c+=1
        if hage=="A":
            a+=1
    if c>1 or c==0:
        return "WA"
    if a>1:
        return "WA"
    return "AC"
        
if __name__ == '__main__':
    hoge=piyo()
    print(hoge)
Buggy code:
def chk(s):
    if s[0]!="A" or s[2:len(s)-1].count("C")!=1: return "WA"
    l=s.index("C")
    print(l)
    for i in range(len(s)):
        if i not in [0,l] and s[i] not in "abcdefghijklmnopqrstuvwxyz": return "WA"
    return "AC"
    


s=input()
print(chk(s))

Fixed code:
def chk(s):
    if s[0]!="A" or s[2:len(s)-1].count("C")!=1: return "WA"
    l=s.index("C")
    for i in range(len(s)):
        if i not in [0,l] and s[i] not in "abcdefghijklmnopqrstuvwxyz": return "WA"
    return "AC"
    


s=input()

print(chk(s))
Buggy code:
str=list(input())
flag=True
if str[0]!='A':
    flag=False
    str[0]='a'
cnt=0
for i in range(2,len(str)-2):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

tmp="".join(str)
if tmp.islower():
    flag=False

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

Fixed code:
str=list(input())
flag=True
if str[0]!='A':
    flag=False
str[0]='a'
cnt=0
for i in range(2,len(str)-1):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

tmp="".join(str)
if not tmp.islower():
    flag=False

if flag==True:
    print("AC")
else:
    print("WA")
Buggy code:
s = list(map(str,input()))
ans = 0
if s[0] == "A":
    ans += 1
S = (s[2:-1])
c = 0
cp = 0
for i in range(len(S)):
    if S[i] == "C":
        c += 1
        cp = i
if c == 1:
    ans += 1
isl = 0
for i in range(len(s)):
    if i == 0 or i == cp+2:
        pass
    else :
        if s[i].islower():
            isl += 1
if isl == len(s)-2:
    ans += 1
if ans == 3:
    print("AC")
else :
    print("WC")


Fixed code:
s = list(map(str,input()))
ans = 0
if s[0] == "A":
    ans += 1
S = (s[2:-1])
c = 0
cp = 0
for i in range(len(S)):
    if S[i] == "C":
        c += 1
        cp = i
if c == 1:
    ans += 1
isl = 0
for i in range(len(s)):
    if i == 0 or i == cp+2:
        pass
    else :
        if s[i].islower():
            isl += 1
if isl == len(s)-2:
    ans += 1
if ans == 3:
    print("AC")
else :
    print("WA")
Buggy code:
S = input()
s = S[2:-1]

judge = "AC"
if S[0] != "A":
	judge = "WA"
else:
	if s.count("C") != 1:
		judge = "WA"
	else:
		S = S.replace("A", "")
		S = S.replace("C", "")
		ch = "Yes"
		print(S)
		for i in S:
			if ord(i) <= 96:
				ch = "No"
		if ch == "No":
			judge = "WA"

print(judge)

Fixed code:
S = input()
s = S[2:-1]

judge = "AC"
if S[0] != "A":
	judge = "WA"
else:
	if s.count("C") != 1:
		judge = "WA"
	else:
		S = S.replace("A", "")
		S = S.replace("C", "")
		ch = "Yes"
		for i in S:
			if ord(i) <= 96:
				ch = "No"
		if ch == "No":
			judge = "WA"

print(judge)
Buggy code:
S = str(input())

if S[0] != "A":
    print("WA")
else:
    if len(S) == 4:
        if "C" not in S[2:]:
            print("WA")
        else:
            if S[1].islower() and ((S[2].islower() and S[3].isupper()) or
                                (S[2].isupper() and S[3].islower)):
                print("AC")
    else:
        s = S[2:-1]
        if "C" not in s:
            print("WA")
        else:
            counter = 0
            for i in S[1:]:
                if i.isupper():
                    counter += 1
            if counter == 1:
                print("AC")

Fixed code:
S = str(input())

if S[0] != "A":
    print("WA")
else:
    if len(S) == 4:
        if S[2] == "C" and S[3].islower() and S[1].islower():
            print("AC")
        elif S[3] == "C" and S[2].islower() and S[1].islower():
            print("AC")
        else:
            print("WA")
    else:
        s = S[2:-1]
        if "C" not in s:
            print("WA")
        else:
            counter = 0
            for i in S[1:]:
                if i.isupper():
                    counter += 1
            if counter == 1:
                print("AC")
            else:
                print("WA")
Buggy code:
S = input()
ans = False
if(S[0]=="A" and S.find("C") != -1):
    S = S.replace("C","c")
    ans = S[1:].islower()
if(ans):
    print("AC")
else:
    print("WA")

Fixed code:
S = input()
ans = False
if(S[0]=="A" and S[2:len(S)-1].find("C") != -1 and S.count("C") == 1):
    S = S.replace("C","c")
    ans = S[1:].islower()
if(ans):
    print("AC")
else:
    print("WA")
Buggy code:
s=input();ans="AC"
if s[0]!="A":ans="WA"
s=s[1:]
if "C"in s[0]+s[-1]:ans="WA"
s=s[1:-1]
if not"C"in s:ans="WA"
n=s.find("C");s=s[:n]+s[n+1:]
for i in range(len(s)):
  if s[i]<="A":ans="WA"
print(ans)

Fixed code:
s=input();ans="AC"
for i in range(len(s)):
  if s[i]<="Z" and "A"!=s[i]!="C":ans="WA"
if s[0]!="A":ans="WA"
s=s[1:]
if "C"in s[0]+s[-1]:ans="WA"
s=s[1:-1]
if not"C"in s:ans="WA"
n=s.find("C");s=s[:n]+s[n+1:]
if "C"in s:ans="WA"
print(ans)
Buggy code:
t=list(input())

if t[0]=="A" and not t[1]=="C" and not t[-1]=="C":
    rs=1
else:
    rs=0

if t[1].isupper()==True or t[-1].isupper()==True:
    rs -=1

del t[:2]
del t[-1]

if not t.count("C")==1:
    rs -=1

if rs==1:
    t.remove("C")

for i in t:
    if i.isupper()==True:
        rs -=1

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

print(rs)


Fixed code:
t=list(input())

if t[0]=="A" and not t[1]=="C" and not t[-1]=="C":
    rs=1
else:
    rs=0

if t[1].isupper()==True or t[-1].isupper()==True:
    rs -=1

del t[:2]
del t[-1]

if not t.count("C")==1:
    rs -=1

if rs==1:
    t.remove("C")

for i in t:
    if i.isupper()==True:
        rs -=1

if rs==1:
    print("AC")
else:
    print("WA")
Buggy code:
import re
 
S = input()
matchObj = re.match("^A[a-z]*C{1}[a-z]*[a-z]$", S)
if matchObj:
  print("AC")
else:
  print("WA")

Fixed code:
import re
 
S = input()
matchObj = re.match("^A[a-z]+C{1}[a-z]*[a-z]$", S)
if matchObj:
  print("AC")
else:
  print("WA")
Buggy code:
S = input()
flag = True
if S[0] == 'A':
    pass
else:
    flag = False

cnt = 0
for i in range(len(S)-3):
    if S[3+i] =='C':
        cnt += 1
if cnt == 1:
    pass
else:
    flag=False

cnt = 0
for i in range(len(S)):
    if S[i].islower():
        cnt += 1
if cnt == 2:
    pass
else:
    flag=False

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

Fixed code:
S = input()
flag = True
if S[0] == 'A':
    pass
else:
    flag = False

cnt = 0
for i in range(len(S)-3):
    if S[2+i] =='C':
        cnt += 1

if cnt == 1:
    pass
else:
    flag=False
cnt = 0
for i in range(len(S)):
    if S[i].islower():
        cnt += 1
if cnt == len(S)-2:
    pass
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')
Buggy code:
s = list(input())
if s[0] == "A" and s[2:-2].count("C") == 1:
    s.remove("A")
    s.remove("C")
    for i in range(len(s)):
        if s[i].islower:
            continue
        else:
            print("WA")
            exit()
    print("AC")

Fixed code:
s = list(input())
if s[0] == "A" and s[2:-1].count("C") == 1:
    s.remove("A")
    s.remove("C")
    for i in range(len(s)):
        if s[i].islower():
            continue
        else:
            print("WA")
            exit()
    print("AC")
else:
    print("WA")
Buggy code:
s = input()

if s[0] == "A" and s[2 : len(s) - 1].count("C") == 1:
    s = s[1:].replace("C", "c")
    if s.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
print(s)

Fixed code:
s = input()

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

if s[0] == 'A':
  if s[:-1].count('C') == 1:
    s = s.replace("A", "", 1)
    s = s.replace("C", "", 1)
    if s.islower():
    	print("AC")
    else:
      print("WA")
  else:
    print("WA")
    
else:
  print("WA")

Fixed code:
s = input()

if s[0] == 'A':
  if s[2:-1].count('C') == 1:
    s = s.replace("A", "", 1)
    s = s.replace("C", "", 1)
    if s.islower():
    	print("AC")
    else:
      print("WA")
  else:
    print("WA")
    
else:
  print("WA")
Buggy code:
s=input()
ls=len(s)
c1=s[0]=="A"
c2=list(s[2:ls-1]).count("S")==1
if c1 and c2:
  s=s.replace("A", "a")
  s=s.replace("S", "s")
  if s.islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Fixed code:
s=input()
ls=len(s)
c1=s[0]=="A"
c2=list(s[2:ls-1]).count("C")==1
if c1 and c2:
  s=s.replace("A", "a")
  s=s.replace("C", "c")
  if s.islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
Buggy code:
S = str(input())
j_count = 0
X = []

for s in S:
    X.append(s)

if X[0] == 'A':
    j_count += 1
    if X[1:len(X)-1].count('C') == 1:
        j_count += 1
        X.remove('A')
        X.remove('C')
        S_n = ''.join(X)
        if S_n.islower():
            j_count += 1

if j_count == 3:
    print('AC')
else:
    print('WA')


Fixed code:
S = str(input())
j_count = 0
X = []

for s in S:
    X.append(s)

if X[0] == 'A':
    j_count += 1
    if X[2:len(X)-1].count('C') == 1:
        j_count += 1
        X.remove('A')
        X.remove('C')
        S_n = ''.join(X)
        if S_n.islower():
            j_count += 1

if j_count == 3:
    print('AC')
else:
    print('WA')
Buggy code:
S = list(input())

ac = False
if S[0] == "A":
    if S[2:len(S)-1].count("C") == 1:
        ac = True

 upper = False
 count = 0
for i in S[2:len(S)-1]:
    if i.isupper():
        count += 1

if count == 1:
    upper = True

if ac and upper:
    print("AC")
else:
    print("WA")


Fixed code:
S = list(input())

ac = False
if S[0] == "A":
    if S[2:len(S)-1].count("C") == 1:
        ac = True

upper = False
count = 0
for i in S:
    if i.isupper():
        count += 1

if count == 2:
    upper = True

if ac and upper:
    print("AC")
else:
    print("WA")
Buggy code:
import sys

s = input()
if s[0] == 'A':
    if 'C' in s[2:-1]:
        index = s[2:-1].index('C')
        news = s[1:index] + s[index+1:]
        if news == news.lower():
            print('AC')
            sys.exit()
print("WA")


Fixed code:
import sys

s = input()
if s[0] == 'A':
    if 'C' in s[2:-1]:
        index = s[2:-1].index('C') + 2
        news = s[1:index] + s[index+1:]
        if news == news.lower():
            print('AC')
            sys.exit()
print("WA")
Buggy code:
S = input()
count = 0
ans = "WA"
L = []
for k in range(len(S)):
    L.append(S[k])

if S[0] == "A":
    for i in range(2,len(S)-2):
        if S[i] == "C":
            count += 1
            c = i
    if count == 1:
        L[0] = "a"
        L[i] = "c"
        for j in range(len(L)):
            if L[j].islower:
                count += 1
        if count == len(L)+1:
            ans = "AC"
print(ans)

Fixed code:
S = input()
count = 0
ans = "WA"
L = []
for k in range(len(S)):
    L.append(S[k])

if L[0] == "A":
    for i in range(2,len(L)-1):
        if L[i] == "C":
            count += 1
            c = i
    if count == 1:
        count2 = 0
        for j in range(len(L)):
            if L[j].islower():
                count2 += 1
        if count2 == len(L)-2:
            ans = "AC"
print(ans)
Buggy code:
S = list(str(input()))

if S[0] == 'A':
    count_C = 0
    for ind in range(3-1, len(S)-1):
        if S[ind] == 'C':
            ind_C = ind
            count_C += 1
    if count_C == 1:
        del S[0]
        del S[ind_C]
        S = 'a'
        for i in S:
            S = S + i
        if S.islower():
            exit()
print('WA')


Fixed code:
S = list(str(input()))

if S[0] == 'A':
    count_C = 0
    for ind in range(3-1, len(S)-1):
        if S[ind] == 'C':
            ind_C = ind
            count_C += 1
    if count_C == 1:
        del S[0]
        del S[ind_C - 1]
        s = 'a'
        for i in S:
            s = s + i
        if s.islower():
            print('AC')
            exit()
print('WA')
Buggy code:
s = input()
ans = 'WA'
if s[0] == 'A' and s[2:-1].count('C') == 1\
   s.replace('A', '').replace('C', '').islower():
  ans = 'AC'
print(ans)nn

Fixed code:
s = input()
ans = 'WA'
if s[0] == 'A' and s[2:-1].count('C') == 1\
   and s.replace('A', '').replace('C', '').islower():
  ans = 'AC'
print(ans)
Buggy code:
s = list(input())
if s[0]=="A" and s[2:-2].count("C")==1:
  s.remove("A")
  s.remove('C')
  if str(s).islower():
    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')
  if str(s).islower():
    print("AC")
  else:
    print('WA')
else:
  print('WA')
Buggy code:
import re

txt = input()
z = re.match("A[a-z]+C[a-z]+", txt)

print("AC" if z else "WA")

Fixed code:
import re

txt = input()
z = re.match("^A[a-z]+C[a-z]+$", txt)

print("AC" if z else "WA")
Buggy code:
def isAC(S):
    if S[0] != 'A':
        return False
    if S[2:-1].count('C') != 1:
        return False
    S = S.remove('C')
    if not all('a' <= x <= 'z' for x in S):
        return False
    return True

print('AC' if isAC(input()) else 'WA')

Fixed code:
def isAC(S):
    if S[0] != 'A':
        return False
    if S[2:-1].count('C') != 1:
        return False
    S = S[1:].replace('C', '')
    if not all('a' <= x <= 'z' for x in S):
        return False
    return True

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

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

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

clen = s[2:-1].count("C")
if clen > 1:
    print('WA')
    exit()

count=0
for ch in s:
    if not ('a' <= ch <= 'z'):
        count += 1
print('WA' if count-clen-1!=0 else 'AC')

Fixed code:
s = input()

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

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

count=0
for ch in s:
    if not ('a' <= ch <= 'z'):
        count += 1
print('WA' if count-2!=0 else 'AC')
Buggy code:
import re
s = input()
pattern = re.compile(r"A[a-z]+C[a-z]+")
match = pattern.match(s)
if(match):
	print ("AC")
else:
	print("WA")


Fixed code:
import re
s = input()
pattern = re.compile(r"^A[a-z]+C[a-z]+$")
match = pattern.match(s)
if(match):
	print ("AC")
else:
	print("WA")
Buggy code:
S=str(input())
cnt=0
for i in range(2,len(S)-2):
    if S[i] =='C':
        cnt+=1
if cnt==1:
    if S[0]=='A':
        T = S.replace("C","").replace("A","")
        if T.islower():
            print("AC")
            exit()
print("WA")

Fixed code:
S=str(input())
cnt=0
for i in range(2,len(S)-1):
    if S[i] =='C':
        cnt+=1
if cnt==1:
    if S[0]=='A':
        T = S.replace("C","").replace("A","")
        if T.islower():
            print("AC")
            exit()
print("WA")