qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = input()

cnt = 0
if S[0] != 'A' or S[-1] == 'C':
    cnt += 1

A = S.replace('A', '')
A = A.replace('C', '')
if len(S) -2 != len(A) or A.islower() == False:
    cnt += 1
if cnt > 0:
    print('WA')
else:
    print('AC')

Fixed code:
S = input()

cnt = 0
if S[0] != 'A' or S[-1] == 'C' or S[1] == 'C':
    cnt += 1

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

Fixed code:
s=input()
if(s[0]=='A'):
    if(s.count('C',2,-1)==1):
        s=s.replace('C','')
        if(s[1:].islower()):
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
S=input()
k=0
z=0
cnt=0
if S[0]=='A':
    for i in range(2,len(S)-1):
        if S[i]=='C':
            k=i
            cnt += 1
            z=100
            if z==100 and cnt==1:
                for j in range(1,k):
                    if 'a'<=S[j]<='z':
                        z=200
                    else:
                        z=101
                if z==200 :        
                    for l in range(k+1,len(S)):
                        if 'a'<=S[l]<='z':
                            z=102
                        else:
                            z=101
if z == 101 or 0 or 100:
    print('WA')
else:
    print('AC')

Fixed code:
S=input()
k=0
z=0
cnt=0
if S[0]=='A':
    for i in range(2,len(S)-1):
        if S[i]=='C':
            k=i
            cnt += 1
            z=100
            if z==100 and cnt==1:
                for j in range(1,k):
                    if 'a'<=S[j]<='z':
                        z=200
                    else:
                        print('WA')
                        exit()
                if z==200 :        
                    for l in range(k+1,len(S)):
                        if 'a'<=S[l]<='z':
                            z=102
                        else:
                            print('WA')
                            exit()
if z == 0 or z==100:
    print('WA')
else:
    print('AC')
Buggy code:
import re
print("AC" if re.match("^A[a-z]+C[a-z]+",input()) else "WA")

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


def main():
    s = input()

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

    count = 0
    for c in s[2:-2]:
        if c == 'C':
            count += 1

    if count != 1:
        print("WA")
        return

    s = s[1:]
    s = s.replace('C', '')
    if s.islower() == False:
        print("WA")
        return

    print("AC")


if __name__ == '__main__':
    main()


Fixed code:
# coding: utf-8


def main():
    s = input()

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

    count = 0
    for c in s[2:-1]:
        if c == 'C':
            count += 1

    if count != 1:
        print("WA")
        return

    s = s[1:]
    s = s.replace('C', '', 1)
    if s.islower() == False:
        print("WA")
        return

    print("AC")


if __name__ == '__main__':
    main()
Buggy code:
#coding:utf-8
s=input()
count=True
dumy=0
if(s[0]=="A"):
  for i in range(2,len(s)-2):
    if(s[i]=="C"):
      dumy+=1
else:
  count=False
if(dumy>1 and dumy==0):
  count=False
dumy=0
for i in range(len(s)):
  if(s[i]>"A" and s[i]<"Z"):
    dumy+=1
if(dumy!=2):
  count=False
if(count==False):
  print("WA")
else:
  print("AC")

Fixed code:
#coding:utf-8
s=input()
count=True
dumy=0
for i in range(len(s)):
  if(s[i]>="A" and s[i]<="Z"):
    dumy+=1
if(dumy!=2):
  count=False
dumy=0
if(s[0]=="A"):
  for i in range(2,len(s)-1):
    if(s[i]=="C"):
      dumy+=1
else:
  count=False
if(dumy!=1):
  count=False
if(count==False):
  print("WA")
else:
  print("AC")
Buggy code:
s=(input())
k=s[2:-1]
m=k.replace('C', 'c',1)
print(k)
print(m)
if k.count('C')==1 and s[0]=='A' and m==k.lower():
    print('AC')
else:
    print('WA')

Fixed code:
s=(input())
k=s[2:-1]
m=k.replace('C', 'c')
t=s[-1]
t1=s[1]
if k.count('C')==1 and s[0]=='A' and m==k.lower() and t==s[-1].lower() and s[1]==t1.lower():
    print('AC')
else:
    print('WA')
Buggy code:
S = input()
N = len(S)
flag = False

for i, charS in enumerate(S):
    if charS == "C" and (1 < i and i < N-1):
        flag = True
        numC = i
        break

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

if flag:
    text = [S[j] for j in range(N) if j != 0 and j != numC]
    text = ''.join(text)
    if not(text.islower):
        flag = False

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

Fixed code:
S = input()
N = len(S)
flag = False

for i, charS in enumerate(S):
    if charS == "C" and (1 < i and i < N-1):
        flag = True
        numC = i
        break

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

if flag:
    text = [S[j] for j in range(N) if j != 0 and j != numC]
    text = ''.join(text)
    if not(text.islower()):
        flag = False

print("AC" if flag else "WA")
Buggy code:
""" AtCoder """

S = input()
count = 0

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        for c in S:
            if c.isupper():
                count += 1
        if count == 2:
            print("AC")
            exit()
print("WA")

print(S[2:-1])


Fixed code:
""" AtCoder """

S = input()
count = 0

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        for c in S:
            if c.isupper():
                count += 1
        if count == 2:
            print("AC")
            exit()
print("WA")
Buggy code:
S = input()
N = len(S)
ans = "AC"
if S[0] != 'A':
  ans = "WA"
c = 0
for i in range(1,N):
  if 2 <= i <= N-1 and S[i] == "C":
    c += 1
  elif S[i] <"a" or "z" < S[i]:
    ans = "WA"
if c != 1:
  ans = "WA"
  
print(ans)


Fixed code:
S = input()
N = len(S)
ans = "AC"
if S[0] != 'A':
  ans = "WA"
c = 0
for i in range(1,N):
  if 2 <= i <= N-2 and S[i] == "C":
    c += 1
  elif S[i] <"a" or "z" < S[i]:
    ans = "WA"
if c != 1:
  ans = "WA"
  
print(ans)
Buggy code:
import sys
input = sys.stdin.readline


def read():
    S = input().strip()
    return S,


def solve(S):
    if S[0] != "A":
        return "WA"
    c_index = -1
    for i in range(len(S)):
        if S[i] == "C":
            if c_index >= 0:
                return "WA"
            c_index = i
    if c_index == -1:
        return "WA"
    for i in range(1, len(S)):
        if i == c_index:
            continue
        elif S[i].lower() != S[i]:
            return "WA"
    return "AC"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


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


def read():
    S = input().strip()
    return S,


def solve(S):
    if S[0] != "A":
        return "WA"
    c_index = -1
    for i in range(2, len(S)-1):
        if S[i] == "C":
            if c_index >= 0:
                return "WA"
            c_index = i
    if c_index == -1:
        return "WA"
    for i in range(1, len(S)):
        if i == c_index:
            continue
        elif S[i].lower() != S[i]:
            return "WA"
    return "AC"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
Buggy code:
s=input()
res="AC"
if s[0]=="A":res="WA"
elif s[2:-2].count("C")!=1:res="WA"
elif "A" in s and "C" in s[2:-2]:
    li=list(s)
    li.remove("A")
    li.remove("C")
    for i in li:
        if i!=i.lower():
            res="WA"
print(res)

Fixed code:
s=input()
res="AC"
if s[0]!="A":res="WA"
elif s[2:-1].count("C")!=1:res="WA"
else:
    li=list(s)
    li.remove("A")
    li.remove("C")
    for i in li:
        if i!=i.lower():
            res="WA"
print(res)
Buggy code:
s = input()
flag = True
flag = flag and s[0] == 'A'
Ccount = 0
for i in range(1,len(s)):
  if ord('a') <= ord(s[i]) and ord(s[i]) <= 'z': continue
  if s[i] == 'C' and 2 <= i and i <= len(s)-2:
    Ccount += 1
  else:
    flag = False
print("AC" if flag and Ccount == 1 else "WA")

Fixed code:
s = input()
flag = True
flag = flag and s[0] == 'A'
Ccount = 0
for i in range(1,len(s)):
  if ord('a') <= ord(s[i]) and ord(s[i]) <= ord('z'): continue
  if s[i] == 'C' and 2 <= i and i <= len(s)-2:
    Ccount += 1
  else:
    flag = False
print("AC" if flag and Ccount == 1 else "WA")
Buggy code:
import sys
S = input()
if S[0] != 'A' or :
    print('WA')
    sys.exit()
    
n = len(S)
ct = 0
for i in range(1, n):
    if S[i].islower():
        if i == 1 or i == n - 1 or S[i] != 'C':
            print('WA')
            sys.exit()
        ct += 1
if ct == 1:
    print('AC')
else:
    print('WA')

Fixed code:
import sys
S = input()
if S[0] != 'A':
    print('WA')
    sys.exit()
    
n = len(S)
ct = 0
for i in range(1, n):
    if S[i].islower() == False:
        if i == 1 or i == n - 1 or S[i] != 'C':
            print('WA')
            sys.exit()
        ct += 1
if ct == 1:
    print('AC')
else:
    print('WA')
Buggy code:
ans = True
key = False
s = input()

for i in range(len(s)):
  if i == 0 and s[0] != "A":
    ans = False
  if (i == 1 or i == len(s)-1) and s[1].isupper():
    ans = False
  if 2 <= i <= len(s)-2:
    if s[i] == "C":
      key = True
    elif s[i].isupper():
      ans = False
if key and ans:
  print("AC")
else:
  print("WA")

Fixed code:
ans = True
key = 0
s = input()

for i in range(len(s)):
  if i == 0 and s[0] != "A":
    ans = False
  if (i == 1 or i == len(s)-1) and s[i].isupper():
    ans = False
  if 2 <= i <= len(s)-2:
    if s[i] == "C":
      key += 1
    elif s[i].isupper():
      ans = False
if key == 1 and ans:
  print("AC")
else:
  print("WA")
Buggy code:
S = input()

alphabets = set(chr(ord('a')+x) for x in range(26))

bl1 = (S[0] == 'A')
bl2 = (S[2:-1].find('C') >= 0)
bl3 = (set(S) - set('AC') <= alphabets)

answer = 'AC' if bl1 and bl2 and bl3 else 'WA'
print(answer)

Fixed code:
S = input()

alphabets = set(chr(ord('a')+x) for x in range(26))

bl1 = (S[0] == 'A')
bl2 = (S[2:-1].count('C') == 1)
bl3 = (set(S) - set('AC') <= alphabets)

answer = 'AC' if bl1 and bl2 and bl3 else 'WA'
print(answer)
Buggy code:
n = input()

result = "AC"
if n[0] != "A":
        result = "WA"
        print(result)
        quit()

carea = n[2:-1]
ccount = 0
for i in carea:
        if i == "C":
                ccount += 1
if ccount >= 2 or ccount == 0:
        result = "WA"
        print(result)
        quit()

for i in carea:
        if i == "A":
                result = "WA"
                print(result)
                quit()

if n[-1] == "C" or n[-1] == "A":
        result = "WA"
        print(result)
        quit()

if n[1] == "C" or n[1] == "A":
        result = "WA"
        print(result)
        quit()


for i in n:
        if i.isupper() == True:
                if i != "A" or i != "C":
                        result = "WA"
                        print(result)
                        quit()
                if i == "T":
                        result = "WA"
                        print(result)
                        quit()
print(result)


Fixed code:
n = input()

result = "AC"
if n[0] != "A":
        result = "WA"
        print(result)
        quit()

carea = n[2:-1]
ccount = 0
for i in carea:
        if i == "C":
                ccount += 1
if ccount >= 2 or ccount == 0:
        result = "WA"
        print(result)
        quit()

for i in carea:
        if i == "A":
                result = "WA"
                print(result)
                quit()

if n[-1] == "C" or n[-1] == "A":
        result = "WA"
        print(result)
        quit()

if n[1] == "C" or n[1] == "A":
        result = "WA"
        print(result)
        quit()


for i in n:
        if i.isupper() == True:
                if i not in "AC":
                        result = "WA"
                        print(result)
                        quit()
print(result)
Buggy code:
from collections import Counter
S = list(input())

if S[0] == 'A':
    if [S[2:-2]].count('C') == 1:
        del S[-2]
        del S[2]
        del S[0]
        s = ''.join(S)
        if s.islower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Fixed code:
from collections import Counter
S = list(input())

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        idx = S[2:-1].index('C')
        del S[idx+2]
        del S[0]
        s = ''.join(S)
        if s.islower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
S = list(input())
l = [chr(i) for i in range(65, 65+26)]

flag = True
if S[0] != 'A':
    flag = False
elif S[1] in l:
    flag = False
elif S[len(S)] in l:
    flag = False
elif not 'C' in S[2:len(S) - 2]:
    flag = False
count = 0
for i in range(2, len(S) - 1):
    if flag == False:
        break
    if S[i] in l:
        count += 1
    if count > 1:
        flag = False
if count < 1:
    flag = False
if flag:
    print('AC')
else:
    print('WA')

Fixed code:
S = list(input())
l = [chr(i) for i in range(65, 65+26)]

flag = True
count = 0
for i in range(len(S)):
    if i == 0:
        if S[i] != 'A':
            flag = False
            break
    if i == 1:
        if S[i] in l:
            flag = False
            break
    if 2 <= i <= len(S) - 2:
        if S[i] == 'C':
            count += 1
        elif S[i] in l:
            flag = False
            break
    if i == len(S) - 1:
        if S[i] in l:
            flag = False
            break
if not count == 1:
    flag = False

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


Fixed code:
S = input()
flag = 0
if S[0] == 'A' and S[2:-1].count('C')==1 :
    if S.replace('A',"").replace('C',"").islower():
        flag =1
        print('AC')
if flag == 0:
    print('WA')
Buggy code:
S = input()
if S[0] == "A":
    flag = False
    index = -1
    for i, x in enumerate(S[2:-2]):
        if S[i] == "C":
            if flag:
                flag = False
                break
            else:
                flag = True
                index = i
    if flag:
        if (len(S[1:i-1]) == 0 or S[1:i-1].islower()) and (len(S[i+1]) == 0 or S[i+1:].islower()):
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")


Fixed code:
S = input()
if S[0] == "A":
    flag = False
    for i, x in enumerate(S[2:-1]):
        if x == "C":
            if flag:
                flag = False
                break
            else:
                flag = True
                index = i+2
    if flag:

        if (len(S[1:index]) == 0 or S[1:index].islower()) and (len(S[index+1:]) == 0 or S[index+1:].islower()):
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
from collections import Counter
s=input()
a=len(s)
counter = Counter(s[2:a-2])
if s[0]!="A":
  print("WA")
  break
else:
  if counter("C")!=1:
    print("WA")
else:
  s.replace("A","a",1)
  s.replace("C","c",1)
  if s.islower()==False:
    print("WA")
  else:
    print("AC")

Fixed code:
from collections import Counter
s=input()
a=len(s)
counter = Counter(s[2:a-1])
if s[0]!="A":
  print("WA")
  
elif counter["C"]!=1:
  
    print("WA")
else:
  
  s[1:].replace("C","c",1)
  if s[1:].replace("C","c",1).islower()==False:
    print("WA")
  else:
    print("AC")
Buggy code:
import re
s = input()
if re.match(r'A[a-z]+C[a-z]+',s) != None:
    print('AC')
else:
    print('WA')

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

flag = True

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

l = s[2:len(s)-1]

count = 0
c = 0
for i,x in enumerate(l):
    if x == 'C':
        count += 1
        c = i

if count != 1:
    flag = False

for x in s:
    if x not in list('abcdefghijklmnopqrstuvwxyz'):
        flag = False

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

Fixed code:
s = list(input())

flag = True

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

l = s[2:len(s)-1]

count = 0
c = 0
for i,x in enumerate(l):
    if x == 'C':
        count += 1
        c = i

if count != 1:
    flag = False

s.pop(2+c)
s.pop(0)

for x in s:
    if x not in list('abcdefghijklmnopqrstuvwxyz'):
        flag = False

if flag:
    print('AC')
else:
    print('WA')
Buggy code:
s=input()
if s[0]=="A" and "C" in s[2] and s[1:].replace("C","",1).islower():
    print(s)
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 = input()
answer = "WA"

if S[0] == 'A' and S[2:-1].count('C') == 1:
    C = S.index('C')
    exception = [0]
    exception.append(C)

if len(exception) == 2:
    for j in range(len(S)):
        if j not in exception and S[j].islower():
            answer = "AC"

print(answer)


Fixed code:
S = input()
count = 0
exception = [0]
answer = "WA"

if S[0] == 'A' and S[2:-1].count('C') == 1:
    C = S.index('C')
    exception.append(C)

if len(exception) == 2:
    for j in range(len(S)):
        if j not in exception and S[j].islower():
            count += 1

if count == len(S)-2:
    answer = "AC"

print(answer)
Buggy code:
s=input()
if s[0]=="A" and "C" in s[2:-1] and len(re.findall('[A-Z]', s))==2:
    print("AC")
else:
    print("WA")

Fixed code:
import re
s=input()
if s[0]=="A" and "C" in s[2:-1] and len(re.findall('[A-Z]', s))==2:
    print("AC")
else:
    print("WA")
Buggy code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = list(ns())
    if S[0] == 'A' and 'C' in S[2:-2]:
        S.remove('A')
        S.remove('C')
        for s in S:
            if s.isupper():
                print('WA')
        print('AC')
    else:
        print('WA')


if __name__ == '__main__':
    main()


Fixed code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = list(ns())
    if S[0] == 'A' and 'C' in S[2:-1]:
        S.remove('A')
        S.remove('C')
        for s in S:
            if s.isupper():
                print('WA')
                return
        print('AC')
    else:
        print('WA')


if __name__ == '__main__':
    main()
Buggy code:
s = input()
t = 0

for i in range(0, len(s)):
  if(s[i].isupper()):
    t = t + 1
  else:
    pass

try:
  if 2 <= s.index('C') and s.index('C') <=len(s)-1:
    if t == 2:
      print('AC')
  else:
    print('WA')

except ValueError:
  print('WA')

Fixed code:
s = input()
t = 0

for i in range(0, len(s)):
  if(s[i].isupper()):
    t = t + 1
  else:
    pass

try:
  if 2 <= s.index('C') and s.index('C') <= len(s)-2 and s.index('A')==0:
    if t == 2:
      print('AC')
    else:
      print('WA')
  else:
    print('WA')

except ValueError:
  print('WA')
Buggy code:
S=input()
C1=(S[0]=='A')
C2=0
for i in range(2:len(S)):
  if S[i]=='C' and i in range(2:len(S)-1):
    C2+=1
  else:
    C1=C1 and S[i].islower()
if C1 and C2==1:
  print('AC')
else:
  print('WA')

Fixed code:
S=input()
C1=S[0]=='A' and S[-1].islower()
C1=C1 and S[1].islower()
C2=0
C3=0
for i in S[2:len(S)-1]:
  if i=='C':
    C2+=1
  elif i.islower():
    C3=C3
  else:
    C3+=1
if C1 and C2==1 and C3==0:
  print('AC')
else:
  print('WA')
Buggy code:

S = input()
alp = "abcdefghijklmnopqrstuvwxyz"
alpC = "abcdefghijklmnopqrstuvwxyzC"

ans = "AC"
if S[0] != "A":
    ans = "WA"
countC = 0
for i in S[2:-1]:
    if i == "C":
        countC += 1
    if not i in alpC:
        ans = "WA"
if countC != 1:
    ans = "WA"
if not S[1] in alp:
    ans = "WA"
if not S[-1] in alp:
    ans = "WA"
pirnt(ans)

Fixed code:
S = input()
alp = "abcdefghijklmnopqrstuvwxyz"
alpC = "abcdefghijklmnopqrstuvwxyzC"

ans = "AC"
if S[0] != "A":
    ans = "WA"
countC = 0
for i in S[2:-1]:
    if i == "C":
        countC += 1
    if not i in alpC:
        ans = "WA"
if countC != 1:
    ans = "WA"
if not S[1] in alp:
    ans = "WA"
if not S[-1] in alp:
    ans = "WA"
print(ans)
Buggy code:
import re
if re.match(r'A[a-z]+C[a-z]+', input()):
  print("AC")
else:
  print("WA")

Fixed code:
import re
if re.match(r'A[a-z]+C[a-z]+$', input()):
  print("AC")
else:
  print("WA")
Buggy code:
s = input()
print("AC" if s[0]=="A" and "C" in s[2:-1] and s[1:].replace("C","").islower() else "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:
# ABC 104: B – AcCepted
s = input()

lowers = 'abcdefghijklmnopqrstuvwxyz'
is_satisfied = 'AC'

if s[0] == 'A' and 'C' in s[2:-2] and s[2:-2].count('C') == 1:
    for letter in s:
        if letter != 'A' and letter != 'C':
            if letter not in lowers:
                is_satisfied = 'WA'
else:
    is_satisfied = 'WA'

print(is_satisfied)

Fixed code:
# ABC 104: B – AcCepted
s = input()

lowers = 'abcdefghijklmnopqrstuvwxyz'
is_satisfied = 'AC'

if s[0] == 'A' and s[2:-1].count('C') == 1:
    for letter in s:
        if letter != 'A' and letter != 'C':
            if letter not in lowers:
                is_satisfied = 'WA'
                break
else:
    is_satisfied = 'WA'

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

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

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

def is_lower_case(c):
  lower_case_alphabets = 'abcdefghijklmnopqrstuvwxyz'
  return c in lower_case_alphabets

S = input()
cnt = Counter(S)

flag = True
if S[0] != 'A':
  flag = False
if cnt['C'] != 1:
  flag = False
for c in S:
  if c != 'C' and not is_lower_case(c):
    flag = False
print('AC' if flag else 'WA')

    

Fixed code:
from collections import Counter

def is_lower_case(c):
  lower_case_alphabets = 'abcdefghijklmnopqrstuvwxyz'
  return c in lower_case_alphabets

S = input()
cnt = Counter(S[2:-1])

flag = True
if S[0] != 'A':
  flag = False
if cnt['C'] != 1:
  flag = False
for c in S[1:]:
  if c != 'C' and not is_lower_case(c):
    flag = False
print('AC' if flag else 'WA')
Buggy code:
import re
print("WA" if re.match('A[a-z]+C[a-z]+',input()) == None else "AC")

Fixed code:
import re
print("WA" if re.match('^A[a-z]+C[a-z]+$',input()) == None else "AC")
Buggy code:
S = input()
print(S[0])
print(S[2:-1])
print(S[0] + S[1:-1] + S[-1:])
print(S[0] + S[1:-1].replace('C', 'c', 1) + S[-1:])

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



Fixed code:
S = input()

if S[0] == 'A' and S[2:-1].count('C') == 1 and (S[1:-1].replace('C', 'c', 1) + S[-1:]).islower():
    print('AC')
else:
    print('WA')
Buggy code:
# -*- coding: utf-8 -*-

s = list(input())

answer = True

if s[0] != "A":
    answer = False

c = 0


for i in range(2,len(s)-1):
    if s[i] == "C":
        c += 1

if c != 1:
    answer = False

capital = 0


for i in range(len(s)):
    if s[i].isupper():
        capital += 1

if capital != 2:
    answer = False

print(answer)

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

s = list(input())

answer = True

if s[0] != "A":
    answer = False

c = 0


for i in range(2,len(s)-1):
    if s[i] == "C":
        c += 1

if c != 1:
    answer = False

capital = 0


for i in range(len(s)):
    if s[i].isupper():
        capital += 1

if capital != 2:
    answer = False

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