#C5298. Count Unique Messages
Count Unique Messages
Count Unique Messages
You are given a string s
which may contain two types of placeholder characters:
#
represents any consonant. There are \(21\) English consonants.@
represents any vowel. There are \(5\) English vowels.
Your task is to compute the total number of unique valid messages by replacing each placeholder with any valid corresponding letter. For each occurrence of #
, multiply the total number of messages by \(21\) and for each occurrence of @
, multiply by \(5\). Characters that are not placeholders do not affect the count. If the string does not contain any placeholders, the number of unique messages is \(1\).
Examples:
- Input:
#
\(\Rightarrow\) Output:21
- Input:
@
\(\Rightarrow\) Output:5
- Input:
##
\(\Rightarrow\) Output:441
(since \(21 \times 21\)) - Input:
#@
\(\Rightarrow\) Output:105
(since \(21 \times 5\)) - Input:
abcdefgh
\(\Rightarrow\) Output:1
inputFormat
The input consists of a single line containing the string s
. The string may include letters and the placeholder characters #
and @
.
Note: The input is provided via standard input (stdin).
outputFormat
Output a single integer representing the total number of unique valid messages that can be formed by replacing the placeholders in the given string.
Note: The output should be written to standard output (stdout).
## sample#
21
</p>