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 the length constraint (though the problem states it's guaranteed, but added for safety) if len(s) < 4 or len(s) > 10: print("WA") exit() # Check the first character is 'A' if s[0] != 'A': print("WA") exit() allowed_start = 2 allowed_end = len(s) - 2 # Extract the substring where 'C' must appear exactly once c_substring = s[allowed_start : allowed_end + 1] count_c = c_substring.count('C') if count_c != 1: print("WA") exit() # Check all other characters are lowercase except the allowed 'A' and 'C' for i in range(len(s)): if i == 0: continue elif allowed_start <= i <= allowed_end: if s[i] == 'C': continue if not s[i].islower(): print("WA") exit() else: if not s[i].islower(): print("WA") exit() print("AC")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.