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() if s[0] != 'A': print("WA") else: # Check for exactly one 'C' in the specified range c_count = 0 for i in range(2, len(s) - 1): if s[i] == 'C': c_count += 1 if c_count != 1: print("WA") else: # Check all other characters are lowercase except the 'A' and 'C' valid = True for i in range(1, len(s)): if 2 <= i <= len(s) - 2 and s[i] == 'C': continue # Valid 'C' in the allowed region 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.