1 + number of X in the tail = 11
The number of Xs in the string is easily calculated if you know how many there are in the tail:
Recall that str.substring(1)
evaluates to the tail of the string,
and that
str.charAt(0)
evaluates to the first character of the string.
Also recall that str.substring(1)
evaluates
to the empty string when the string has only one character.
Fill in the blanks.