|
|||
Word IndexEncoding schemes are often used in situations requiring encryption or information storage/transmission economy. Here, we develop a simple encoding scheme that encodes particular types of words with five or fewer (lowercase) letters as integers.
Consider the English alphabet {
are all valid three-letter words, whereas
are not. For each valid word, associate an integer which gives the position of the word in the alphabetized list of words. That is:
Your program is to read a series of input lines. Each input line will have a single word on it, that will be from one to five letters long. For each word read, if the word is invalid, give the number 0. If the word read is valid, give the word's position index in the above alphabetical list. Input Specification
The input consists of a series of single words, one per line. The words are at least one
letter long and no more than five letters. Only the lowercase alphabetic { The input will be terminated by end-of-file. Output SpecificationThe output is a single integer, greater than or equal to zero (0) and less than or equal to 83681. The first digit of an output value should be the first character on a line. There is one line of output for each input line. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |