UVa 444

From Algorithmist
Jump to navigation Jump to search

444 - Encoder and Decoder[edit]

Summary[edit]

We need to determine whether or not a string is encoded by the first character. If its a number then its encoded or else its decoded and you have to do the opposite operation.

Explanation[edit]

  • To encode a message append the values of each character to a string and reverse it.
  • To decode a message reverse the string and convert the value of a given character into a character.

Gotchas[edit]

  • When parsing the encoded message be sure to test your lowercase test cases well.

Input[edit]

abc
798999
Have a Nice Day !
001

Output[edit]

998979
cba
332312179862310199501872379231018117927
d

References[edit]