Problem I
Sacred Texts
You are a respected dwarven archaeologist. Your job consists of scouring ruins and reading ancient texts.
Recently while under an expedition your team had uncovered sacred texts you believe belong to the Great Circles.
Each dwarven rune consists of one or more characters. These characters are in the ASCII decimal range of $33$–$47$: !"#$%&'()*+,-./ with values in increasing order. So ! has a value of $1$ as it’s the first, " has a value of $2$ because it’s the second, etc. According to your studies, adjacent characters in the same rune add their values together.
Runes are separated by spaces. In the dwarven language a 0 indicates a space, while a < and > represent commas and periods respectively; these special runes will always consist of a single character. All other runes correspond to lowercase English letters. The ancient dwarves used the same ordering of letters as the modern alphabet, but as a Great Circle with no beginning nor ending.
Be warned however, that the year that a text is written impacts its translation. The rune !*&() in 1389 would not translate to the same letter as it would in 1689 due to unpredictable rotations in the Great Circle. You need to correct for this somehow.
Luckily your team has plenty of samples in the library that they can use as a reference to decode the text.
Input
Input starts with a line consisting of a single rune, followed (space-separated) by its translated lowercase English letter.
Then up to $8$ lines of dwarven text follow, each consisting of at most $100$ characters.
Output
Output the translated texts.
Sample Input 1 | Sample Output 1 |
---|---|
* h * ' . . .# 0 '%- #. /% . & > |
hello world. |
Sample Input 2 | Sample Output 2 |
---|---|
/! n ." ' !.) ' .& 0 ) "/ +% /! # 0 ) + +- ' 0 ! ,% "'. 0 #.& *( > $, ' -+ ' &. 0 ) &+ &* !/ # 0 . ' $+' 0 ! !)' +, 0 & "/ '#/ !/ > /! ' .* ' .& 0 ) +& %+ &* # 0 $." .) (( 0 # ,( %, #"'+ *& & < # /! & 0 & ' #+' ' %/ *, 0 ! .# ',$ > ,$ ' %/$ ' !.% 0 ) +& )' *& # 0 / # - ' 0 ! ,% -* 0 % '- ! < ". ' ($, ' .& 0 ) %, *& %+ # 0 %." # ! 0 ) *' () & $ ! ' > &* ' /) ' &. 0 ) "/ /! $, # 0 $!,% ' . . 0 # 0 . + ' < # *& & 0 * &!+% )+ ++ 0 ! .# '$, > |
never gonna give you up. never gonna let you down. never gonna run around, and desert you. never gonna make you cry, never gonna say goodbye. never gonna tell a lie, and hurt you. |