Description

A certain dictionary contains all words that consist only of vowels A, E, I, O, and U that are five-letter long at maximum. The first letter in the dictionary is "A", which is followed by "AA", and so on. The last word will be "UUUUU".

Suppose that a parameter word is given, where word is a single word. Please write a function solution that returns the rank of that word in the dictionary given above.

Constraints
  • The length of word is between 1 and 5.
  • word consists only of the following uppercase letters: A, E, I, O, and U.
Examples
word result
"AAAAE" 6
"AAAE" 10
"I" 1563
"EIO" 1189

Example #1

The first word in the dictionary is "A", followed by "AA", "AAA", "AAAA", "AAAAA", "AAAAE", and so on. "AAAAE" is the sixth word in the dictionary, and therefore its rank is 6.

Example #2

There will be "A", "AA", "AAA", "AAAA", "AAAAA", "AAAAE", "AAAAI", "AAAAO", and "AAAAU", which is followed by "AAAE"--the tenth word in the dictionary, and therefore its rank is 10.

Example #3

"I" is the 1563rd word in the dictionary.

Example #4

"EIO" is the 1189th word in the dictionary.

Result Stop
내가 제출한 코드가 왜 틀렸는지 프로그래머스 AI에게 물어보세요.
제출 후 채점하기를 눌러 30점 이상인 경우 물어볼 수 있어요.
베타 기간 동안에는 한 문제당 1번만 물어볼 수 있어요.