Mock CCC '20 Contest 1 J1 - Cryptic Letter
View as PDFA typical reader of Jonathan's letter.
Jonathan wants to find his true love. As he is only interested in people who are smarter than him, he has decided to send out a puzzle in the form of a letter. Whoever solves the puzzle will be relentlessly pursued by Jonathan to the ends of the Earth.
The letter consists of a single string , where
is composed only of distinct lowercase letters (no spaces). The goal is to find an anagram made up of only letters found in
. Jonathan wants to know the total number of anagrams,
, that the recipient of the letter will have to consider. It is guaranteed that
.
An anagram is a string formed by rearranging the letters of , using all letters exactly once. You can consider
to be an anagram of itself.
Input Specification
A single string .
Output Specification
A single number .
Sample Input 1
ih
Sample Output 1
2
Sample Input 2
oej
Sample Output 2
6
Comments