#K38777. Valid Message Checker
Valid Message Checker
Valid Message Checker
You are given a string s
. Your task is to determine whether it is a valid message based on the following rules:
- The number of 'B's in
s
must be at most one, i.e., $$\#B \leq 1$$. - The number of 'C's in
s
must be at most two, i.e., $$\#C \leq 2$$.
If both conditions are satisfied, output True
; otherwise, output False
.
Examples:
- For
s = "AAC"
, the output should beTrue
. - For
s = "BBC"
, the output should beFalse
. - For
s = "CCCC"
, the output should beFalse
.
inputFormat
The input consists of a single line containing the string s
.
outputFormat
Output a single line: True
if the string s
is a valid message according to the rules, otherwise False
.
AAC
True