P1603 Snowden's Password

Background

An easy problem based on the Snowden incident. Testdata has been corrected by absi2011. If there are still issues, please contact me.

Description

On X month, X day, 2013, Russia processed Snowden’s passport, and he blended into a plane bound for Venezuela. However, this plan was careless, because FBI spies had already learned his exact location—but that’s not the most important part—the crucial point is that to reach Venezuela, one must pass through Cuba, and the route through Cuba is under U.S. control. A deranged Obama forced Snowden’s plane to land, but during the search, Snowden was nowhere to be found. However, a note was found on what was said to be Snowden’s seat. The note was in pure English: `Obama is a two five zero.` (Ends with `.`, contains only $6$ words + one period; the sentence is valid even if it does not start with a capital letter.) Although the sentence looked nonsensical, Officer Chen Junwu noticed it was an extremely important clue. He found a C++ program on a laptop intercepted from Snowden; after inputting this sentence, it immediately produced the corresponding password. Chen Junwu was so happy that he fainted. As the police officer, you took the note and the program onto the plane, ready to fly to Manhattan International Airport, but during an in-flight check you discovered—the program had been destroyed! Only $5$ minutes remain before the plane lands in Washington. You must write (fabricate) a program within these $5$ minutes to avoid your superior’s $10000000000 \bmod 10$ paddlings. The steps to decipher the password are as follows: 1. Find all numbers in the sentence written in English $(\leq 20)$, listed below: - Standard: `one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty`. - Non-standard: `a both another first second third`. - To avoid ambiguity, treat `another` as $1$. 2. Square these numbers and take them modulo $100$, e.g., $0 \to 0 \to 00$, $5 \to 25 \to 25$, $19 \to 361 \to 61$. 3. Concatenate these two-digit numbers (in any order) to form a new number. If it starts with $0$, drop the leading zeros, e.g., $\{00,25,61\} \to 2561$. 4. Among all permutations, find the smallest number; this is the password.

Input Format

A sentence containing $6$ words. The total number of characters in the whole sentence (including spaces) does not exceed $1000$.

Output Format

An integer (the password). If no eligible numbers appear, output $0$.

Explanation/Hint

Translated by ChatGPT 5