Word number
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Consider a sequence consisting of all possible words of length N, where letters A, B, and C are used in even positions, and letters D and E are used in odd positions. The positions in the words are numbered from left to right, starting with 0. This sequence is arranged in lexicographical order.
Given two words from this sequence, determine the total number of words in the sequence that lie strictly between them.
Input
The input consists of two lines. The first line contains the first word, and the second line contains the second word. Both words have the same length, which does not exceed 48.
Output
Output a single line containing the number of words that are strictly between the two given words in the sequence.
Examples
Input #1
Answer #1
Submissions 122
Acceptance rate 8%