You are given a string S. Each character of S is uppercase or lowercase English letter.…
- User
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions:
- The initial character of S is an uppercase
A. - There is exactly one occurrence of
Cbetween the third character from the beginning and the second to last character (inclusive). - All letters except the
AandCmentioned above are lowercase.
Constraints
- 4 ≤ |S| ≤ 10 (|S| is the length of the string S.)
- Each character of S is uppercase or lowercase English letter. Input
Input is given from Standard Input in the following format:
S
Output
If S satisfies all of the conditions in the problem statement, print
AC; otherwise, printWA.Examples
Input
AtCoder
Output
AC
Input
ACoder
Output
WA
Input
AcycliC
Output
WA
Input
AtCoCo
Output
WA
Input
Atcoder
Output
WA
- The initial character of S is an uppercase
Assistant
pythons = input().strip() # Check initial condition if s[0] != 'A': print("WA") else: # Check for exactly one 'C' in the specified range middle = s[2 : len(s)-1] c_count = middle.count('C') if c_count != 1: print("WA") else: # Find the position of the 'C' in the original string c_pos_in_middle = middle.index('C') c_pos = 2 + c_pos_in_middle # Check all other characters are lowercase valid = True for i in range(len(s)): if i == 0: continue elif i == c_pos: if s[i] != 'C': valid = False break else: if not s[i].islower(): valid = False break print("AC" if valid else "WA")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.