qyliang/CodeNanoFix huggingface dataset:
Buggy code:
s=input()
S=list(s)
cc=0
for i in range(2,len(S)-1):
  if S[i]=='C':
    cc=cc+1
    S.remove(S[i])
S.remove(S[0])
count=[]
if s[0]=='A':
  count.append(1)
if cc==1:
  count.append(2)
if ''.join(S).islower():
  count.append(3)

if count==[1,2,3]:
  print('AC')
else:
  print('WA')

Fixed code:
s=input()
S=list(s)
cc=0
for i in range(2,len(S)-1):
  if S[i]=='C':
    cc=cc+1
if cc>=1:
  S.remove('C')
S.remove(S[0])
count=[]
if s[0]=='A':
  count.append(1)
if cc==1:
  count.append(2)
if ''.join(S).islower():
  count.append(3)

if count==[1,2,3]:
  print('AC')
else:
  print('WA')
Buggy code:
S = list(input())
last = len(S) - 1

S_head = S[0]

S_clone = S
S_bothEnd = [S[0],S[1],S[last]]
S_center = list(set(S)-set(S_bothEnd))

S_clone.remove('A')
S_clone.remove('C')

evalLow = "".join(S_clone)

if S_head == "A" and S_center.count("C")  == 1 and evalLow.islower() == 1:
  print('AC')
else:
  print('WA')

Fixed code:
S = list(input())
last = len(S) - 1

S_head = S[0]

S_bothEnd = [S[0],S[1],S[last]]
S_center = list(set(S)-set(S_bothEnd))

S_clone = S
if "A" in S_clone:
  S_clone.remove('A')
if "C" in S_clone:
  S_clone.remove('C')

evalLow = "".join(S_clone)

if S_head == "A" and S_center.count("C")  == 1 and evalLow.islower() == 1:
  print('AC')
else:
  print('WA')
Buggy code:
s = input()

noAC = s.replace('A', '').replace('C', '')
content = s[2:len(s)-1]

if s[0] != 'A' or (not('C' in content)) or (not noAC.islower()):
  print('WA')
else:
  print('SC')


Fixed code:
s = input()

noAC = s.replace('A', '').replace('C', '', 1)
content = s[2:len(s)-1]

if s[0] != 'A' or (not('C' in content)) or (not noAC.islower()):
  print('WA')
else:
  print('AC')
Buggy code:
S = input()

def hasC(txt):
    c = 0
    for t in txt:
        if t == "C":
            if c > 0:
                return False
            c = 1
    return True
def allLower(txt):
    a = ord("a")
    z = ord("z")
    for t in txt:
        tc = ord(t)
        if tc < a or tc > z:
            return False
    return True


if len(S) < 4:
    print("WA")
    exit()
if S[0] != "A":
    print("WA")
    exit()
if not hasC(S[2:-1]):
    print("WA")
    exit()
nonC = S[:2] + S[2:-1].replace("C", "") + S[-1]
if not allLower(nonC[1:]):
    print("WA")
    exit()
print("AC")

Fixed code:
S = input()

def hasC(txt):
    c = 0
    for t in txt:
        if t == "C":
            if c > 0:
                return False
            c = 1
    return c == 1
def allLower(txt):
    a = ord("a")
    z = ord("z")
    for t in txt:
        tc = ord(t)
        if tc < a or tc > z:
            return False
    return True

if S[0] != "A":
    print("WA")
    exit()
if not hasC(S[2:-1]):
    print("WA")
    exit()
nonC = S[:2] + S[2:-1].replace("C", "") + S[-1]
if not allLower(nonC[1:]):
    print("WA")
    exit()
print("AC")
Buggy code:
# abc104_b.py
S = input()
upper_cnt=0
print(S[2:-1])
for i,c in enumerate(S):
    if (i==0 and c!="A") or S[2:-1].count("C")!=1 or (i==1 and not c.islower()):
        print('WA')
        exit()
    if i>=1 and c.isupper():
         upper_cnt+=1
    if upper_cnt >1:
        print('WA')
        exit()
print('AC')



Fixed code:
# abc104_b.py
S = input()
upper_cnt=0
for i,c in enumerate(S):
    if (i==0 and c!="A") or S[2:-1].count("C")!=1 or (i==1 and not c.islower()):
        print('WA')
        exit()
    if i>=1 and c.isupper():
         upper_cnt+=1
    if upper_cnt >1:
        print('WA')
        exit()
print('AC')
Buggy code:
n=list(input())
count=0
if n[0]=='A' and n[2:-1].count('C')==1:
    del n[0]
    n.remove('C')
    print(n)
    for i in range(len(n)):
        if n[i].islower()==1:
            count+=1
    if count==len(n):
        print('AC')
    else:
        print('WA')
    
else:
    print('WA')

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


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

if s[0] != 'A':
    print('WA')
    sys.exit(0)
for i in range(2, len(s) - 1):
    if [i] == 'C':
        s.pop(i)
        break
else:
    print('WA')
    sys.exit(0)

if ''.join(s[1:]) == ''.join(s[1:]).lower():
    print('AC')
else:
    print('WA')

Fixed code:
import sys
s = list(input())
 
if s[0] != 'A':
    print('WA')
    sys.exit(0)

for i in range(2, len(s) - 1):
    if s[i] == 'C':
        s.pop(i)
        break
else:
    print('WA')
    sys.exit(0)
 
if ''.join(s[1:]) == ''.join(s[1:]).lower():
    print('AC')
else:
    print('WA')
Buggy code:
s = input()
if s[0] == "A" and s[2:-1] in "C":
  i = s.index("C")
  ss = s[1:i] + s[i+i:]
  if ss.islower() == True:
    print("AC")
  else:
    print("WA")
else:
  print("WA")


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

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        S.replace('C', '')
        if S[1:].islower():
            print('AC')
            exit()

print('WA')

Fixed code:
S = input()

if S[0] == 'A':
    if S[2:-1].count('C') == 1:
        if S[1:].replace('C', '').islower():
            print('AC')
            exit()

print('WA')
Buggy code:
s = list(input())
alpha = [chr(i) for i in range(97, 97+26)]

flag = True
if s[0] != "A" or (not "C" in s[2:-1]):
  flag = False
  
else:
  cin = s.index("C")
  for i in range(len(s)):
    if i == 0 or i == cin:
      continue

    if (not s[i] in alpha):
      flag = False
      break
    
print("AC" if flag else "WC")

Fixed code:
s = list(input())
alpha = [chr(i) for i in range(97, 97+26)]

flag = True
if s[0] != "A" or (not "C" in s[2:-1]):
  flag = False
  
else:
  cin = s.index("C")
  for i in range(len(s)):
    if i == 0 or i == cin:
      continue

    if (not s[i] in alpha):
      flag = False
      break
    
print("AC" if flag else "WA")
Buggy code:

inp = input()
count = 0
index = 0
for i in range(len(inp[2:-1])):
  if inp[2:-1][i] == "C":
      count += 1
      index = i
if inp[0] == "A":
  if count == 1:
    if (inp[1:2+index]+inp[3+index:]).islower():
        print("AC")
else: 
  print("WA")
    

Fixed code:
inp = input()
count = 0
index = 0
for i in range(len(inp[2:-1])):
  if inp[2:-1][i] == "C":
      count += 1
      index = i
if inp[0] == "A" and count == 1 and (inp[1:2+index]+inp[3+index:]).islower():
  print("AC")
else: 
  print("WA")
Buggy code:
S = list(input())
flagx = 0
flagy = 0
if S[0] == "A":
  S.pop(0)
else:
  flagx = 1
  
for i in range(len(S)-2):
  if S[i] == "C":
    S.pop(i)
    flagy = 0
    break
  else:
    flagy = 1
    
if str(S).islower() and flagx == 0 and flagy == 0:
  print("AC")
else:
  print("WA")

Fixed code:
S = list(input())
flagx = 0
flagy = 0
if S[0] == "A":
  S.pop(0)
else:
  flagx = 1
  
for i in range(1,len(S)-1):
  if S[i] == "C":
    S.pop(i)
    flagy = 0
    break
  else:
    flagy = 1
    
if str(S).islower() and flagx == 0 and flagy == 0:
  print("AC")
else:
  print("WA")
Buggy code:
S = list(input())
if S[0] != 'A':
    print('WA')
    exit

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

S.pop(0)
S.pop(S.index('C'))

for string in S:
    if not string.islower():
        print('WA')
        exit

print('AC')


Fixed code:
import sys

S = list(input())
if S[0] != 'A':
    print('WA')
    sys.exit()

S_aida = S[2:-1]
if S_aida.count("C") != 1:
    print('WA')
    sys.exit()

S.pop(0)
S.pop(S.index('C'))

for string in S:
    if not string.islower():
        print('WA')
        sys.exit()

print('AC')
Buggy code:
s=str(input())
temp=list(s)
if temp[0]=="A":
  del temp[len(s)-1]
  del temp[1]
  del temp[0]
  if "C" in temp:
    s=s.replace("A","")
    s=s.replace("C","")
    if s.islower()==True:
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Fixed code:
s=str(input())
temp=list(s)
if temp[0]=="A":
  del temp[len(s)-1]
  del temp[1]
  del temp[0]
  c=temp.count("C")
  if c==1:
    s=s.replace("A","")
    s=s.replace("C","")
    if s.islower()==True:
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")
Buggy code:
s = input()
def end():
    print("WA")
    exit()
if s[0] != 'A':
    end()
flag = False
for i in s[3:-1]:
    if i == 'C':
        if flag:
            end()
        flag = True
if not flag:
    end()

flag = False
for i in range(1,len(s)):
    if s[i].isupper():
        if flag:
            end()
        flag = True

print("AC")

Fixed code:
s = input()
def end():
    print("WA")
    exit()
if s[0] != 'A':
    end()
flag = False
for i in s[2:-1]:
    if i == 'C':
        if flag:
            end()
        flag = True
if not flag:
    end()

flag = False
for i in range(1,len(s)):
    if s[i].isupper():
        if flag:
            end()
        flag = True

print("AC")
Buggy code:
S = input()
ac = 1
if S[0] != 'A':
    ac = 0
c = 0
for i in range(1,len(S)):
    if 2 <= i <= len(S) and S[i] == 'C':
        c += 1
        continue
    if S[i].isupper():
        ac = 0
if c == 1 and ac:
    print('AC')
else:
    print('WA')

Fixed code:
S = input()
ac = 1
if S[0] != 'A':
    ac = 0
c = 0
for i in range(1,len(S)):
    if 2 <= i <= (len(S) - 2) and S[i] == 'C':
        c += 1
        continue
    if S[i].isupper():
        ac = 0
if c == 1 and ac:
    print('AC')
else:
    print('WA')
Buggy code:
s = input()
smalls = "abcdefghijklmnopqrstuvwxyz"
def solve(s):
    count = 0

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

    if s[1] not in smalls:
        return False
    for char in s[2:]:
        if char == "C":
            count += 1
            continue

        if char not in smalls:
            return False
    if count != 1:
        return False
    return True

if solve(s):
    print("AC")
else:
    print("WA")


Fixed code:
s = input()
smalls = "abcdefghijklmnopqrstuvwxyz"
def solve(s):
    count = 0
 
    if s[0] != "A":
        return False
 
    if s[1] not in smalls:
        return False
    for char in s[2:-1]:
        if char == "C":
            count += 1
            continue
 
        if char not in smalls:
            return False
    if count != 1:
        return False
    if s[-1] not in smalls:
	    return False
    return True
 
if solve(s):
    print("AC")
else:
    print("WA")
Buggy code:
import re

point1 = 0
count1 = 0
point2 = 0
point3 = 0
	
S = input()
l = len(S)
if S[0]=='A':
	point1+=1
for n in range(2,l-2):
	if S[n]=='C':
		count1+=1
if count1==1:
	point2+=1
	
SS = re.sub("A","",S)
SS = re.sub("C","",SS)
if SS.islower():
	point3+=1
	
xx = point1+point2+point3

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

Fixed code:
import re

point1 = 0
count1 = 0
point2 = 0
point3 = 0
	
S = input()
l = len(S)
if S[0]=='A':
	point1+=1
for n in range(2,l-1):
	if S[n]=='C':
		count1+=1
if count1==1:
	point2+=1
	
SS = re.sub("A","",S)
SS = re.sub("C","",SS)
if SS.islower():
	point3+=1
	
xx = point1+point2+point3

if xx==3:
	print('AC')
else:
	print('WA')
Buggy code:
S = input()
if S[0] != "A":
    print("WA")
    exit()
num_C = 0
pos_C = 0
for i in range(2, len(S)):
    if S[i] == "C":
        num_C += 1
        pos_C = i
if num_C != 1:
    print("WA")
    exit()
for i in range(1, len(S)):
    if i == pos_C:
        continue
    if S[i].isupper():
        print("WA")
        exit()
print("AC")


Fixed code:
S = input()
if S[0] != "A":
    print("WA")
    exit()
num_C = 0
pos_C = 0
for i in range(2, len(S) - 1):
    if S[i] == "C":
        num_C += 1
        pos_C = i
if num_C != 1:
    print("WA")
    exit()
for i in range(1, len(S)):
    if i == pos_C:
        continue
    if S[i].isupper():
        print("WA")
        exit()
print("AC")
Buggy code:
S = input()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[1:L-1] and Slist.count('C') == 1:
    Slist.remove('A', 'C')
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')


Fixed code:
S = input()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[2:L-1] and Slist.count('C') == 1:
    Slist.remove('A')
    Slist.remove('C') 
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')
Buggy code:
S=input()
s=list(S)

if s[0]!='A':
    print('WC')
else:
    if s.count('C')!=1:
        print('WC')
    else:
        if s.index('C')<2 or s.index('C')>len(s)-2:
            print('WC')
        else:
            s.remove('A')
            s.remove('C')
            
            count=0
            for i in range(len(s)):
                if str.islower(s[i]):
                    count+=1
            if count==len(s):
                print('AC')
            else:
                print('WC')

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

if s[0]!='A':
    print('WA')
else:
    if s.count('C')!=1:
        print('WA')
    else:
        if s.index('C')<2 or s.index('C')>len(s)-2:
            print('WA')
        else:
            s.remove('A')
            s.remove('C')
            
            count=0
            for i in range(len(s)):
                if str.islower(s[i]):
                    count+=1
            if count==len(s):
                print('AC')
            else:
                print('WA')
Buggy code:
S = input()
if S[0] == "A" and S[2:-1].count("C") == 1:
    S = S.replace("A","").replace("C","")
    print(S)
    if all(i.islower for i in S):
        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.replace("A","").replace("C","")
    if all(i.islower() for i in S):
        print("AC")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
S=input()
if S[0]=="A" and S[2:-1].count("C")==1:
	index=s.index("C")
	S=S[1:index]+S[index+1:]
	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:
	index=S.index("C")
	S=S[1:index]+S[index+1:]
	if S.islower():
		print("AC")
	else:
		print("WA")	
else:
	print("WA")
Buggy code:
#104B
s = "AtCoder"
c_list = []
c_count = 0
answer = "WA"
for i in range(2,len(s)-1):
    if s[i] == "C":
        c_list.append(i)
    if s[i].islower() == False:
        c_count += 1
if s[0]=="A" and s[1].islower()==True and s[-1].islower()==True and len(c_list)==1 and c_count==1:
    answer="AC"
print(answer)

Fixed code:
#104B
s = input()
c_list = []
c_count = 0
answer = "WA"
for i in range(2,len(s)-1):
    if s[i] == "C":
        c_list.append(i)
    if s[i].islower() == False:
        c_count += 1
if s[0]=="A" and s[1].islower()==True and s[-1].islower()==True and len(c_list)==1 and c_count==1:
    answer="AC"
print(answer)
Buggy code:
i=input()
if i[0]=="A"and i[2:-1].count("C")==1:
    i[2:-1].replace("C","c",1)
    if i[1:].islower()==True:
        print("AC")
else:print("WA")

Fixed code:
i=input()
if i[0]=="A"and i[2:-1].count("C")==1\
and i[1:].replace("C","c",1).islower()==True:
    print("AC")
else:print("WA")
Buggy code:
s = input()
flag = True
if s[0] != 'A':
    flag = False
elif 'C' not in s[2:-1]:
    flag = False
else:
    s=list(s)
    s.remove('C')
    if not str(s[1:]).islower():
        flag = False
        print('rrr')

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

Fixed code:
s = input()
flag = True
if s[0] != 'A':
    flag = False
elif 'C' not in s[2:-1]:
    flag = False
else:
    s=list(s)
    s.remove('C')
    if not str(s[1:]).islower():
        flag = False

if flag:
    print('AC')
else:
    print('WA')
Buggy code:
S = str(input())
flag = False
count = 0
tmp_str = ""
if S.count("C") == 1 and S[0] == "A":
  flag = True
  for i in range(1,len(S),1):
    if S[i] == "C":
      count = i
    else:
      tmp_str += S[i]

if (flag == True) and (count > 1) and (count < len(S)-1):
  print("Yes")
else:
  print("WA")

Fixed code:
S = str(input())
flag = False
count = 0
tmp_str = ""
if S.count("C") == 1 and S[0] == "A":
  flag = True
  for i in range(1,len(S),1):
    if S[i] == "C":
      count = i
    else:
      tmp_str += S[i]

if (flag == True) and (count > 1) and (count < len(S)-1) and (tmp_str.islower() == True):
  print("AC")
else:
  print("WA")
Buggy code:
s=input()
if s[0]!="A":
  print("WA")
  exit()
s=s[1:]
count_C=0
for i in range(len(s)):
  if s[i]=="C":
    count_C+=1
if count_C!=1:
  print("WA")
  exit()
s.replace("C","")
if not s.islower():
  print("WA")
  exit()
print("AC")

Fixed code:
s=input()
if s[0]!="A":
  print("WA")
  exit()
s=s[1:]
count_C=0
for i in range(len(s)-2):
  if s[i+1]=="C":
    count_C+=1
if count_C!=1:
  print("WA")
  exit()
s=s.replace("C","")
if not s.islower():
  print("WA")
  exit()
print("AC")
Buggy code:
def main():
    S = input()
    flag = True
    cnt = 0
    for i in range(len(S)):
        if not(i == 0 and S[i] == 'A'):
            print("WA")
            return
        elif 2 <= i <= len(S)-1 and S[i] == 'C':
            cnt += 1
        elif S[i].isupper():
            print("WA")
            return
    if cnt == 1:
        print("AC")
    else:
        print("WA")
            
main()

Fixed code:
def main():
    S = input()
    flag = True
    cnt = 0
    for i in range(len(S)):
        if i == 0:
            if S[i] != 'A':
                print("WA")
                return
        else:
            if 2 <= i <= len(S)-2 and S[i] == 'C':
                cnt += 1
            elif S[i].isupper():
                print("WA")
                return
    if cnt == 1:
        print("AC")
    else:
        print("WA")
            
main()
Buggy code:
S = input()
cnt = S[2:-1].count('C')

if s in S[1:]:
    if s.isupper() and s != 'C':
        print('WA')
        break
else:
    if S[0] == 'A' and cnt == 1:
        print('AC')
    else:
        print('WA')

Fixed code:
S = input()
cnt = S[2:-1].count('C')
 
for s in S[1:]:
    if s.isupper() and s != 'C':
        print('WA')
        break
else:
    if S[0] == 'A' and cnt == 1:
        print('AC')
    else:
        print('WA')
Buggy code:
s=input()
if s[0]=='A':
  s=s.lstrip('A')
else:
  print('WA')
  exit()

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

Fixed code:
s=input()
if s[0]=='A':
  s=s.lstrip('A')
else:
  print('WA')
  exit()

if s[1:-1].count('C')==1:
  s=s.replace('C','')
else:
  print('WA')
  exit()
  
if s.islower():
    print('AC')
else:
  print('WA')
Buggy code:
S=input()
if S[0]=='A':
    if S[2:-1].count('C')==1:
        i = S.index('C')
        tmp = S[1:i]+S[i+1:]
        tmp_low=tmp.lower()
        print(tmp)
        print('AC' if tmp==tmp_low else 'WA')
    else:
        print('WA')
else:
    print('WA')

Fixed code:
S=input()
if S[0]=='A':
    if S[2:-1].count('C')==1:
        i = S.index('C')
        tmp = S[1:i]+S[i+1:]
        tmp_low=tmp.lower()
        print('AC' if tmp==tmp_low else 'WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
S = input()
flag = True
if S[0] != 'A':
    flag = False
elif 'C' in S[2:len(S)-1]:
    s2 = S.replace('C', '', 1)
    if 'C' in s2:
        flag = False
if flag:
    s2 = s2.replace('A', '', 1)
    if s2.islower():
        flag = True
    else:
        flag = False
if flag:
    print('AC')
else:
    print('WA')



Fixed code:
S = input()
flag = True
if S[0] != 'A':
    flag = False
elif 'C' not in S[2:len(S)-1]:
    flag = False
s2 = S.replace('C', '', 1)
if 'C' in s2:
    flag = False
    
if flag:
    s2 = s2.replace('A', '', 1)
    if s2.islower():
        flag = True
    else:
        flag = False
if flag:
    print('AC')
else:
    print('WA')
Buggy code:
S = input()
ans = 'WA'
if S[0] == 'A':
	if S[2:-2].count('C') == 1:
		p = 0
		for i in range(2, len(S) - 1):
			if S[i] == 'C':
				p = i
		if S[1:p].islower() and S[p+1:].islower():
			print(S[1:p])
			print(S[p+1:])
			ans = 'AC'
print(ans)

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

Fixed code:
S=input()
if S[0] != "A":
  print("WA")
elif len([i for i in S[2:-1] if i == "C"]) != 1:
  print("WA")
elif len([i for i in S if i.islower()]) != len(S)-2:
  print("WA")
else:
  print("AC")
Buggy code:
S = input()

count = 0
boo = False
if S[0] != 'A':
    print ('WA')
else:
    if S[1].islower() == False:
        print('WA')
    else:
        if S[-1].islower() == False:
            print ('WA')
        else:
            for str_ in S[2:-2]:
                if str_ == 'C':
                    count += 1
                else:
                    if str_.islower() == True:
                        pass
                    else:
                        boo = True

            if count == 1 and boo == False:
                print ('AC')
            else:
                print ('WA')


Fixed code:
S = input()

count = 0
boo = False
if S[0] != 'A':
    print ('WA')
else:
    if S[1].islower() == False:
        print('WA')
    else:
        if S[-1].islower() == False:
            print ('WA')
        else:
            for str_ in S[2:-1]:
                if str_ == 'C':
                    count += 1
                else:
                    if str_.islower() == True:
                        pass
                    else:
                        boo = True

            if count == 1 and boo == False:
                print ('AC')
            else:
                print ('WA')
Buggy code:
S=input()
N=len(S)
count=0
if S[0]=="A":
	if S[2:-2].count("C")==1 and S[1]!="C"and S[-1]!="C":
		P=S.replace("A","")
		Q=P.replace("C","")
		if Q.islower():
			print("AC")
		else:
			print("WA")
	else:
		print("WA")
else:
	print("WA")

Fixed code:
S=input()
N=len(S)
count=0
if S[0]=="A":
	if S[2:-1].count("C")==1 and S[1]!="C"and S[-1]!="C":
		P=S.replace("A","")
		Q=P.replace("C","")
		if Q.islower():
			print("AC")
		else:
			print("WA")
	else:
		print("WA")
else:
	print("WA")
Buggy code:
s = input().rstrip()
 
ans = 'WA'
if s[0] == 'A' and s[2:len(s) - 1].count('C') == 1:
  i = s[2:len(s) - 1].find('C')
  if s[1:i+2].islower() and s[i + 2 + 1:].islower():
    ans = 'AC'


Fixed code:
s = input().rstrip()

ans = 'WA'
if s[0] == 'A' and s[2:len(s) - 1].count('C') == 1:
    i = s[2:len(s) - 1].find('C')
    if s[1:i + 2].islower() and s[i + 2 + 1:].islower():
        ans = 'AC'
print(ans)
Buggy code:
S = input()
if S[0] == 'A':
    S = 'a' + S[1:]
    print(S)
    if S[2:-1].count('C') == 1:
        S = S[:S.index('C')] + 'c' + S[S.index('C')+1:]
        print(S)
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Fixed code:
S = input()
if S[0] == 'A':
    S = 'a' + S[1:]
    if S[2:-1].count('C') == 1:
        S = S[:S.index('C')] + 'c' + S[S.index('C')+1:]
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
x = list(input())
#print(len(x))

if x[0]=="A" :
	for i in range(2,len(x)-1):
		if x[i]=="C" :
#			print(x)
			del	x[i]
			del x[0]
			y="".join(x)
			#print(y)
			if y.islower():
				print("AC")
				break
			else:
					print("WA")
else:
	print("WA")

#print(x)


Fixed code:
x = list(input())
#print(x[])

if x[0]=="A" :
	for i in range(2, len(x)-1, 1):
		if x[i]=="C":
			#print(x)
			del	x[i]
			del x[0]
			y="".join(x)
			#print(y)
			if y.islower():
				print("AC")
				break
			else:
				print("WA")
				break
	else:
		print("WA")

else:
	print("WA")

#print(x)