The number 1
looks quite similar to the letter l
and the letter I
. Similarly, the number 0
looks quite similar to the letter o
. Sometimes, these simple replacements are used in passwords.
Roger is reviewing his passwords one day, and realizes that he no longer remembers what letters he replaced with numbers! Alarmed, he pulls up the following table:
Number | Letter |
---|---|
0 | O |
1 | l |
3 | E |
4 | A |
5 | S |
6 | G |
8 | B |
9 | g |
Given a string of alphanumeric characters, can you write a program to perform these replacements?
Constraints
The given string will contain no more than characters.
Input Specification
The first and only line of input will contain a single string of alphanumeric characters.
Output Specification
The output should have a single string: the result of performing all the replacements on the string given in the input.
Sample Input
y0105w49
Sample Output
yOlOSwAg
Comments
How exactly is a lookup table slower than branch statements with their potential branch predication misses in their fetch pipeline? I kind of question the legitimacy of the grader because of that. If you also notice there is a big difference in memory usage from pre 2022 submissions and post for similar algorithms implemented using the same compiler/interpreter/toolchain on almost any problem on the website. Maybe that is expected but that seems a bit off to me.
Random server luck. If you're trying to go for the fastest solution, your sub will be affected by random background processes that can delay your sub by 1-2 ms. Try resubmitting a few times.
The runtimes are upgraded often. Newer compilers tend to use more memory. Probably caused by https://en.wikipedia.org/wiki/Software_bloat
The admins can rejudge subs, but rejudging on every compiler upgrade is a bad use of resources.