#C2691. XO: Equal Counts of X and O
XO: Equal Counts of X and O
XO: Equal Counts of X and O
You are given a string s
. Your task is to check whether the number of occurrences of the letter x
is equal to the number of occurrences of the letter o
in the string.
Note that the comparison should be case-insensitive. In other words, uppercase and lowercase letters are considered the same. Formally, let \(X = \text{count}(\text{'x'})\) and \(O = \text{count}(\text{'o'})\). The answer is True
if \(X = O\) and False
otherwise.
If the string does not contain either x
or o
, then \(X = 0\) and \(O = 0\) are trivially equal, so the output should be True
.
inputFormat
The input consists of a single line containing a string s
. The string can contain any ASCII characters.
outputFormat
Output a single line containing either True
or False
depending on whether the number of 'x' and 'o' characters in s
(ignoring case) are equal.
ooxx
True