P1246 Encoding
Description
Encoding is often used for ciphertext or compressed transmission. Here we use one of the simplest methods: map some structured words to numbers.
There are $26$ letters in the alphabet, $\mathtt{a,b,c,\cdots,z}$. These special words have length at most $6$, and their letters are in strictly increasing order. Put all such words together and sort them in lexicographic order. The code of a word is the position of that word in this dictionary.
For example:
- $\verb!a! \to 1$.
- $\verb!b! \to 2$.
- $\verb!z! \to 26$.
- $\verb!ab! \to 27$.
- $\verb!ac! \to 28$.
Your task is to compute the code of the given word.
Input Format
A single line containing the word to be encoded.
Output Format
A single line containing the corresponding code. If the word is not in this dictionary, output $0$.
Explanation/Hint
Translated by ChatGPT 5