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

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

cnt = 0
i = 0
for j, c in enumerate(s):
    if j <= 1 or j == len(s) - 1:
        continue
    print(c)
    if c == 'C':
        cnt += 1
        if cnt == 2:
            print('WA')
            exit(0)
        i = j
if cnt == 0:
    print('WA')
    exit(0)

for j, c in enumerate(s):
    if j == 0 or j == i:
        continue
    if str(c).isupper():
        print('WA')
        exit(0)

print('AC')


Fixed code:
s = input()

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

cnt = 0
i = 0
for j, c in enumerate(s):
    if j <= 1 or j == len(s) - 1:
        continue
    if c == 'C':
        cnt += 1
        if cnt == 2:
            print('WA')
            exit(0)
        i = j
if cnt == 0:
    print('WA')
    exit(0)

for j, c in enumerate(s):
    if j == 0 or j == i:
        continue
    if str(c).isupper():
        print('WA')
        exit(0)

print('AC')
Buggy 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")


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()
c1, c2, c3 = False, False, False
#print(c1, c2, c3)
import re
#print(s[2:-1])

if s[0] == "A":
  c1 = True
if s[2:-2].find("C") >= 0:
  c2 = True
if len(re.findall("[a-z]", s)) == len(s)-2:
  c3 = True
#print(c1, c2, c3)
#print(len(re.findall("[a-z]", s)))

if c1 and c2 and c3:
  print("AC")
else:
  print("RE")

Fixed code:
s = input()
c1, c2, c3 = False, False, False
#print(c1, c2, c3)
import re
#print(s[2:-1])

if s[0] == "A":
  c1 = True
if s[2:-1].find("C") >= 0:
  c2 = True
if len(re.findall("[a-z]", s)) == len(s)-2:
  c3 = True
#print(c1, c2, c3)
#print(len(re.findall("[a-z]", s)))

if c1 and c2 and c3:
  print("AC")
else:
  print("WA")
Buggy code:
letters = input()
C = letters[2:-3]
D = letters.replace("A","a").replace("C","c")


if letters[0] == "A" and C.count("C") == 1 and D.islower() == True  :
  print("AC")
else:
  print("WA")

Fixed code:
letters = input()
C = letters[2:-1]
D = letters.replace("A","a").replace("C","c")

if letters[0] == "A" and C.count("C") == 1 and D.islower() == True  :
  print("AC")
else:
  print("WA")
Buggy code:
s = input()
a=s.index('C')
print('AC' if s[0]=='A' and s.count('C')==1 and s[1:a]+s[a+1:]==(s[1:a]+s[a+1:]).lower() and 1<a<len(s)-1 else 'WA')

Fixed code:
s = input()
if s.count('C')==1:
    a=s.index('C')
else:
    a=0
print('AC' if s[0]=='A' and s.count('C')==1 and s[1:a]+s[a+1:]==(s[1:a]+s[a+1:]).lower() and 1<a<len(s)-1 else 'WA')
Buggy code:
import sys
S = list(input())
N = len(S)
if S[0] == "A":
    s = 0
    for i in S[1:len(S)-1]:
        if i == "C":
            s += 1
    if s == 1:
        c = 0
        for i in S:
            if i.islower():
                 c += 1
        if c == N-2:
            print("AC")
            sys.exit()
print("WA")




Fixed code:
import sys
S = list(input())
N = len(S)
if S[0] == "A":
    s = 0
    for i in S[2:len(S)-1]:
        if i == "C":
            s += 1
    if s == 1:
        c = 0
        for i in S:
            if i.islower():
                 c += 1
        if c == N-2:
            print("AC")
            sys.exit()
print("WA")
Buggy code:
s = input()
count = 0

for i in s:
    if ord("A") <= ord(i) <= ord("Z"):
        count += 1
else:
    if s[0] == "A" and 2 <= s.index("C") <= len(s)-3 and count == 2:
        print("AC")
    else:
        print("WA")


Fixed code:
s = input()
count = 0

for i in s:
    if ord("A") <= ord(i) <= ord("Z"):
        count += 1
else:
    if s.count("C") == 0:
        print("WA")
        exit()
    if s[0] == "A" and 2 <= s.index("C") <= len(s)-2 and count == 2:
        print("AC")
    else:
        print("WA")
Buggy code:
large=list("BDEFGHIJKLMNOPQRSTUVWXYZ")
small=list("abcdefghijklmnopqrstuvwxyz")
s=list(input())
if s[0]!="A" or s.count("A")!=1:
  print("WA")
  exit()
t=s[3:len(s)-1]
if t.count("C")!=1:
  print("WA")
  exit()
for i in s:
  if i in large:
    print("WA")
    exit()
print("AC")

Fixed code:
large=list("BDEFGHIJKLMNOPQRSTUVWXYZ")
small=list("abcdefghijklmnopqrstuvwxyz")
s=list(input())
if s[0]!="A" or s.count("A")!=1:
  print("WA")
  exit()
t=s[2:len(s)-1]
if t.count("C")!=1:
  print("WA")
  exit()
for i in s:
  if i in large:
    print("WA")
    exit()
print("AC")
Buggy code:
S=list(input())
length = len(S)
z1 = 0
z2 = 0
z3 = 0
if S[0] == "A":
    z1 = 1

for i in range(1,length-1):
    if S[i] == "C":
        z2 = z2 + 1

for i in range(length):
    if S[i].islower()==False:
        z3 = z3 + 1       

if [z1,z2,z3] == [1,1,2]:
    print("AC")
else:
    print("WA")


Fixed code:
S=list(input())
length = len(S)
z1 = 0
z2 = 0
z3 = 0
if S[0] == "A":
    z1 = 1

for i in range(2,length-1):
    if S[i] == "C":
        z2 = z2 + 1

for i in range(length):
    if S[i].islower()==False:
        z3 = z3 + 1       

if [z1,z2,z3] == [1,1,2]:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()

a = S.count('A')
c = S[2:-1].count('C')

i = S.find('C')
if S[0] == 'A' and a == 1 and c == 1:
    temp = S[2:i]+S[i+1:-1]
    if 1 < i and i < len(S)-1 and temp.islower():
        print('AC')
    else:
        print('WC')
else:
    print('WC')

Fixed code:
S = input()

a = S.count('A')
c = S[2:-1].count('C')

i = S.find('C')
if S[0] == 'A' and a == 1 and c == 1:
    temp = S[1:i]+S[i+1:]
    if 1 < i and i < len(S)-1 and temp.islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
s = input()
ok = True

ok &= s[0] == 'A'
ok &= s[1].islower()
ok &= s[2:-1].count('C') == 1
ok &= all(c.islower() for c in s[2:-1] if c != 'C')
ok &= s[-1].islower()

print('AC' if ok else 'No')


Fixed code:
s = input()
ok = True

ok &= s[0] == 'A'
ok &= s[1].islower()
ok &= s[2:-1].count('C') == 1
ok &= all(c.islower() for c in s[2:-1] if c != 'C')
ok &= s[-1].islower()

print('AC' if ok else 'WA')
Buggy code:
S = input()
cnt = 0
for i in range(len(S)):
  if i==0 and S[i]!="A":
    print("WA")
    exit()
  if 2<=i<=len(i)-2 and S[i]=="C":
    cnt+=1
    if cnt>1:
      print("WA")
      exit()
  if 1<=i<=len(i)-1:
    if S[i]!="C" and S[i].isupper():
      print("WA")
      exit()
print("AC")
    

Fixed code:
S = input()
cnt = 0
for i in range(len(S)):
  if i==0 and S[i]!="A":
    print("WA")
    exit()
  if 2<=i<=len(S)-2 and S[i]=="C":
    cnt+=1
    if cnt>1:
      print("WA")
      exit()
  if 1<=i<=len(S)-1:
    if S[i]!="C" and S[i].isupper():
      print("WA")
      exit()
if cnt<1:
  print("WA")
  exit()
print("AC")
Buggy code:
from sys import stdin
import re

S = stdin.readline().rstrip()

pattern1 = r'A.C[a-z]{1, 7}'
pattern2 = r'A[a-z]{2}C[a-z]{1, 6}'
pattern3 = r'A[a-z]{3}C[a-z]{1, 5}'
pattern4 = r'A[a-z]{4}C[a-z]{1, 4}'
pattern5 = r'A[a-z]{4}C[a-z]{1, 3}'
pattern6 = r'A[a-z]{4}C[a-z]{1, 2}'
pattern7 = r'A[a-z]{4}C[a-z]{1}'

if (re.match(pattern1, S)) or (re.match(pattern2, S)) or (re.match(pattern3, S)) or (re.match(pattern4, S)) \
        or (re.match(pattern5, S)) or (re.match(pattern6, S)) or (re.match(pattern7, S)):
    print('AC')
else:
    print('WA')

Fixed code:
from sys import stdin
import re

S = stdin.readline().rstrip()

pattern1 = r"^A([a-z])C([a-z]{1,7})$"
pattern2 = r'^A([a-z]){2}C([a-z]{1,6})$'
pattern3 = r'^A([a-z]){3}C([a-z]{1,5})$'
pattern4 = r'^A([a-z]){4}C([a-z]{1,4})$'
pattern5 = r'^A([a-z]){5}C([a-z]{1,3})$'
pattern6 = r'^A([a-z]){6}C([a-z]{1,2})$'
pattern7 = r'^A([a-z]){7}C([a-z]{1})$'

if (re.match(pattern1, S)) or (re.match(pattern2, S)) or (re.match(pattern3, S)) or (re.match(pattern4, S)) \
        or (re.match(pattern5, S)) or (re.match(pattern6, S)) or (re.match(pattern7, S)):
    print('AC')
else:
    print('WA')
Buggy code:
import re

S = str(input())

ans = "AC"

uppercount = len(re.findall('[a-z]', S))
if not uppercount == 2:
    ans = "WA"

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

cfind = S[2:-1].find("C")
if cfind < 0 and uppercount == 1:
    ans = "WA"

if not S[1:cfind+2].islower and S[cfind+3:].islower():
    ans = "WA"

print(ans)


Fixed code:
import re

S = str(input())

ans = "AC"

uppercount = len(re.findall('[A-Z]', S))
if not uppercount == 2:
    ans = "WA"

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

cfind = S[2:-1].find("C")
if cfind < 0:
    ans = "WA"

if not S[1:cfind+2].islower and S[cfind+3:].islower():
    ans = "WA"

print(ans)
Buggy code:
S = input()
alphabets = set(chr(ord('a')+x) for x in range(26))

f1 = (S[0]=="A")
f2 = (S[2:-1].count("C")==1)
f3 = (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:
s = input()

if s[0] == "A" and s[2:-2].count("C") == 1:

    s = s[1:].replace("C", "c")
    if s.islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Fixed code:
s = input()

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


ans = 0
num = 0
cnum = 0
if S[0] == "A":
  ans += 1

for i in range(2,len(S)-1):
  if S[i] == "C":
    cnum += 1
    
if cnum == 1:
  ans +=1

for j in range(len(S)):
  if j.islower() == True:
    num += 1

    
if num == len(S)-2:
  ans +=1
  
  
  

if ans ==3:
  print("AC")
else:
  print("WA")

Fixed code:
S = input()


ans = 0
num = 0
cnum = 0

if S[0] == "A":
  ans += 1

for i in range(2,len(S)-1):
  if S[i] == "C":
    cnum += 1
    
if cnum == 1:
  ans +=1

for j in range(len(S)):
  if S[j].islower() == True:
    num += 1

    
if num == len(S)-2:
  ans +=1
  
  
  

if ans ==3:
  print("AC")
else:
  print("WA")
Buggy code:
from sys import stdin


def main() -> None:
    s = next_str()
    print(("WA", "AC")[judge(s)])


def judge(s: str) -> bool:
    flg = False
    n = len(s)

    for i in range(n):
        if i == 0 and s[i] != 'A':
            return False
        elif 2 <= i < n - 1 and s[i] == 'C' and not flg:
            flg = True
        elif s[i] != s[i].lower():
            return False

    if not flg:
        return False
    return True


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Fixed code:
from sys import stdin


def main() -> None:
    s = next_str()
    print(("WA", "AC")[judge(s)])


def judge(s: str) -> bool:
    flg = False
    n = len(s)

    for i in range(n):
        if i == 0:
            if s[i] != 'A':
                return False
        elif 2 <= i < n - 1 and s[i] == 'C' and not flg:
            flg = True
        elif s[i] != s[i].lower():
            return False

    if not flg:
        return False
    return True


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


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

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

Fixed code:
s = input()

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

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

str = input()

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

str.replace('A', 'a', 1)

flag = False

for i in range(2, len(str) - 1) :
    if str[i] == 'C':
        str.replace('C' , 'c', 1)
        flag = True
        
if not flag :
    print("WA")
    sys.exit()

if str.islower():
    print("AC")
else:
    print("WA")

Fixed code:
import sys

str = input()

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

str = str.replace('A', 'a', 1)

flag = False

for i in range(2, len(str) - 1) :
    if str[i] == 'C':
        str = str.replace('C' , 'c', 1)
        flag = True
        break
        
if not flag :
    print("WA")
    sys.exit()

if str.islower():
    print("AC")
else:
    print("WA")
Buggy code:
s = list(input())

flag = True
if s[0] != "A":
    flag = False

ss = s[2:-1]
# print(ss)
if ss.count("C") != 1:
    flag = False
for si in s:
    if si != "A" or si != "C":
        if si.islower() != True: 
            flag = False
print("AC" if flag else "WA")


Fixed code:
s = list(input())

flag = True
if s[0] != "A":
    flag = False

ss = s[2:-1]
if ss.count("C") != 1:
    flag = False
for si in s:
    if si != "A" and si != "C":
        if si.islower() != True: 
            flag = False
            
print("AC" if flag else "WA")
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:
import re

S = input()

if(S[0] == 'A'):
    regex = r'[a-z]*C[a-z]*[a-z]'
    ans = re.match(regex, S[3:len(S)])
    if(ans != None):
        if(ans.span() == (0, len(S[3:len(S)]))):
            print('AC')
        else:
            print('WA')
    else:
        print('WA')


Fixed code:
import re

S = input()

regex = r'A[a-z][a-z]*C[a-z]*[a-z]'
ans = re.match(regex, S)
if(ans != None):
    if(ans.span() == (0, len(S))):
        print('AC')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
S = input()

ans = "WA"

if S[0] == "A":
    if S[:3].count("C") + S[-2:].count("C") == 1:
        removed_str = ""
        if S[:3].count("C") == 1:
            removed_str += S[1:3].replace("C", "") + S[3:]
        else:
            removed_str += S[1:-2] + S[-2:].replace("C", "")
        if removed_str.islower():
            ans = "AC"

print(ans)


Fixed code:
S = input()

ans = "WA"

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

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

Fixed code:
s=input()
if s[0]!="A" or ("C" not in s[2:-1]) or s.count("C")!=1 or s[1:].replace("C","").lower()!=s[1:].replace("C",""):
    print("WA")
else:print("AC")
Buggy code:
import re
print("WA" if re.match("A[a-z]+C[a-z]", input()) is None else "AC")

Fixed code:
import re
print("WA" if re.match("A[a-z]+C[a-z]+$", input()) is None else "AC")
Buggy code:
def solve(s):
    if(s[0] == "A"):
        v = s[1:]
        i = s.find("C")
        if(i >= 2 and i < len(s)):
            k = v[:i-1] + v[i:]
            if(k.islower()):
                return "AC"
    return "WA"

s = input()
print(solve(s))

Fixed code:
def solve(s):
    if(s[0] == "A"):
        v = s[1:]
        i = v.find("C")
        if(i >= 1 and i < len(v)-1):
            k = v[:i] + v[i+1:]
            if(k.islower()):
                return "AC"
    return "WA"
 
s = input()
print(solve(s))
Buggy code:
s = input()

if len(s) >= 4 and len(s) <= 10 and s[0]=="A" and s[2:-1].count("C")==1:
    try:
        ss = list(s[2:-1])
        ss.remove("C")
        ss = s[1] + ss + s[-1]
        if ''.join(ss).islower():
            print("AC")
        else:
            print("WA")
    except:
        print("WA")
else:
    print("WA")


Fixed code:
s = input()

if len(s) >= 4 and len(s) <= 10 and s[0]=="A" and s[2:-1].count("C")==1:
    try:
        ss = list(s[2:-1])
        ss.remove("C")
        ss += s[-1]
        if s[1].islower() and ''.join(ss).islower():
            print("AC")
        else:
            print("WA")
    except:
        print("WA")
else:
    print("WA")
Buggy code:
# https://atcoder.jp/contests/abc104/tasks/abc104_b


def main():
    S = input()
    if S[0] == "A" and S[2:-2].count("C") == 1:
        S = S.replace('A', '').replace('C', '')
        if all(c.islower() for c in S):
            print("AC")
            exit()

    print("WA")


if __name__ == '__main__':
    main()




Fixed code:
# https://atcoder.jp/contests/abc104/tasks/abc104_b


def main():
    S = input()
    if S[0] == "A" and S[2:-1].count("C") == 1:
        S = S.replace('A', '', 1).replace('C', '', 1)
        if all(c.islower() for c in S):
            print("AC")
            exit()

    print("WA")


if __name__ == '__main__':
    main()
Buggy code:
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
  index_C = s.find("C")
  print(index_C)
  if s[1:index_C].islower() and s[index_C+1:]:
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Fixed code:
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
  index_C = s.find("C")
  if s[1:index_C].islower() and s[index_C+1:].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
Buggy code:
s = input()
sc = s.index("C")
if s[0]=="A" and s[2:-1].count("C")==1 and (s[1:sc]+s[sc+1:]).islower():
    print("AC")
else:
    print("WA")

Fixed code:
s = input()
if s[0]=="A" and s[2:-1].count("C")==1:
    sc = s.index("C")
    if (s[1:sc]+s[sc+1:]).islower():
        print("AC")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
a = list(input())
k = 0
for i in range(len(a)):
	if i == 0 and a[i] != "A":
		k = 1
		break
	elif i >= 2 and i <= len(a)-2:
		if a[i] == "C":
			k += 2
		elif a[i] > z or a[i] < a:
			k = 1
			break
	else:
		if a[i] > "z" or a[i] < "a":
			k = 1
			break
if k == 2:
	print("AC")
else:
	print("WA")



Fixed code:
a = list(input())
k = 0
for i in range(len(a)):
	if i == 0 and a[i] != "A":
		k = 1
		break
	elif i == 0:
		k = k
	elif i >= 2 and i <= len(a)-2:
		if a[i] == "C":
			k += 2
		elif a[i] <= "z" and a[i] >= "a":
			k = k
		else:
			k = 1
			break
	else:
		if a[i] <= "z" and a[i] >= "a":
			k = k
		else:
			k = 1
			break
if k == 2:
	print("AC")
else:
	print("WA")
Buggy code:
s = input()
if s[0] == 'A' and s[2:-2].count('C') == 1:
    Ci = s.index('C')
    if (s[1:Ci] + s[Ci + 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:s.index('C')] + s[s.index('C') + 1:]).islower():
    print('AC')
else:
    print('WA')
Buggy code:
S = list(input())
ans ="AC"
if S[0]!="A":
    ans ="WA"
if S.count("C") !=1:
    ans ="WA"
if S[2:-1].count("C")!=1:
    ans ="WA"
if S[0]==("A"):
    del S[0]
if S.count("C")>0:
    S.remove("C")
for i in range(len(S)):
    if (S[i]).isupper:
        ans = "WA"
print(ans)

Fixed code:
S = list(input())
ans ="AC"
if S[0]!="A":
    ans ="WA"
if S.count("C") !=1:
    ans ="WA"
if S[2:-1].count("C")!=1:
    ans ="WA"
if S[0]==("A"):
    del S[0]
if S.count("C")>0:
    S.remove("C")
S = str(S)
for i in range(len(S)):
    if (S[i]).isupper():
        ans = "WA"
print(ans)
Buggy code:
S = input()
check = 0
tmp = S[2:-1].split('C')
if (S[0]=='A') and (len(tmp)==2) and S[1].lower()==S[1]:
    for i in range(len(tmp)):
        if tmp[i].lower() != tmp[i]:
            check += 1
    if check == len(tmp):
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Fixed code:
S = input()
check = 0
tmp = S[2:-1].split('C')
if (S[0]=='A') and (len(tmp)==2) and S[1].lower()==S[1] and S[-1].lower()==S[-1]:
    for i in range(len(tmp)):
        if tmp[i].lower() == tmp[i]:
            check += 1
    if check == len(tmp):
        print('AC')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
i = input()

flag = i[2:-1].count("C")

if i[0] is not "A":
    flag = 0

import re

print(i[2:-1])
print(re.findall("A[a-z][a-z,C]{"+str(len(i)-3)+"}[a-z]",i),flag)

if re.findall("A[a-z][a-z,C]{"+str(len(i)-3)+"}[a-z]",i) and (flag == 1):
    print("AC")

else:
    print("WA")


Fixed code:
i = input()

flag = i[2:-1].count("C")

if i[0] is not "A":
    flag = 0

import re
if re.findall("A[a-z][a-z,C]{"+str(len(i)-3)+"}[a-z]",i) and (flag == 1):
    print("AC")

else:
    print("WA")
Buggy code:
s = input()
count = 0
for i in range(1, len(s)-1):
    if s[i] == 'C':
        count = count + 1
        s = s[:i] + 'c' + s[i+1:]
    else:
        continue
if s[0] != 'A':
    flag = False
elif count != 1:
    flag = False
else:
    s = 'a' + s[1:]
    flag = s.islower()
if flag:
    print('AC')
else:
    print('WA')

Fixed code:
s = input()
count = 0
for i in range(2, len(s)-1):
    if s[i] == 'C':
        count = count + 1
        s = s[:i] + 'c' + s[i+1:]
    else:
        continue
if s[0] != 'A':
    flag = False
elif count != 1:
    flag = False
else:
    s = 'a' + s[1:]
    flag = s.islower()
if flag:
    print('AC')
else:
    print('WA')
Buggy code:
# B - AcCepted
S = str(input())
count = 0
if S[0] == 'A':
    for i in range(2,len(S)-2):
        if S[i] == 'C':
            count += 1
        else:
            pass

    if count == 1:
        S_1 = set(S)
        S_1.remove('A')
        S_1.remove('C')
        if str(S_1).islower() :
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Fixed code:
# B - AcCepted
S = str(input())
count = 0
if S[0] == 'A':
    for i in range(2,len(S)-1):
        if S[i] == 'C':
            count += 1
        else:
            pass

    if count == 1:
        S_1 = set(S)
        S_1.remove('A')
        S_1.remove('C')
        if str(S_1).islower() :
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
s = input()
if s[0] == 'A' and 'C' in s[2:-2]:
  c = s.index('C')
  if s[1:c] + s[c+1:] == (s[1:c] + s[c+1:]).lower:
    print('AC')
    exit()
print('WA')

Fixed code:
s = input()
if s[0] == 'A' and 'C' in s[2:-1]:
  c = s.index('C')
  if s[1:c] + s[c+1:] == (s[1:c] + s[c+1:]).lower():
    print('AC')
    exit()
print('WA')
Buggy code:
S = input()
A = False
B = False
C = False
ans = 'WA'
if S[0] == 'A':
  A = True
if S[2:-1].find('C') == S[2:-1].rfind('C'):
  B = True
  S = S.lstrip('A')
  D = S[S.find('C')+1:]
  E = S[:S.find('C')]
  if D.islower() == True and E.islower() == True:
    C = True
if A == True and B == True and C == True:
  ans = 'AC'
print(ans)

Fixed code:
S = input()
A = False
C = False
ans = 'WA'
if S[0] == 'A':
  A = True
if S[2:-1].find('C') != -1 and S[2:-1].find('C') == S[2:-1].rfind('C'):
  S = S.lstrip('A')
  D = S[S.find('C')+1:]
  E = S[:S.find('C')]
  if D.islower() == True and E.islower() == True:
    C = True
if A == True and C == True:
  ans = 'AC'
print(ans)
Buggy code:
s=list(input())
ans='WA'
if s.pop(0) == 'A':
    for i in range(1,len(s)-1):
        print(s[i])
        if s[i] == 'C':
            s.pop(i)
            print(s)
            if "".join(s).islower():
                ans='AC'
                break
            break
print(ans)


Fixed code:
s=list(input())
ans='WA'
if s.pop(0) == 'A':
    for i in range(1,len(s)-1):
        if s[i] == 'C':
            s.pop(i)
            if "".join(s).islower():
                ans='AC'
                break
            break
print(ans)
Buggy code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def check(str):
	print(str)
	cnt = 0
	for s in str:
		if s.islower():
			cnt += 1
	return cnt == len(str) - 1 and str.find('C') != -1

S = input()

if S[0] == 'A' and S[1] != 'C' and S[len(S) - 1] != 'C' and check(S[2:len(S) - 1]) and S[1].islower() and S[len(S) - 1].islower():
	print('AC')
else:
	print('WA')



Fixed code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def check(str):
	cnt = 0
	for s in str:
		if s.islower():
			cnt += 1
	return cnt == len(str) - 1 and str.find('C') != -1

S = input()

if S[0] == 'A' and S[1] != 'C' and S[len(S) - 1] != 'C' and check(S[2:len(S) - 1]) and S[1].islower() and S[len(S) - 1].islower():
	print('AC')
else:
	print('WA')