Noob cipher

Description

Discuss (27 comments)
A simple cipher that makes messages quite unreadable is the substitution cipher. The substitution cipher replace one alphabet letter with another alphabet letter. The goal of this puzzle is to decrypt a message encoded with a substitution cipher.

We'll use the term substitution table to describe the table used for replacing characters.
For example, the following table:
ZYXWVUTSRQPONMLKJIHGFEDCBA
Means that during the encryption phase the letters will be replaced following this substitution:
Original ABCDEFGHIJKLMNOPQRSTUVWXYZ
-------- ||||||||||||||||||||||||||
Replaced ZYXWVUTSRQPONMLKJIHGFEDCBA

Input Specifications

Your program must take 2 arguments:
  1. the substitution table (it is a string argument) used to encrypt the message
  2. the file containing the encrypted message
For example:
The substitution table is
BCDEFGHIJKLMNOPQRSTUVWXYZA
The file containing the encrypted message is
XFMDPNF UP DPEFS DIBSUT

Output Specifications

The output must contain the decrypted message. The output result must be printed on the standard output.

For the previous example, the output should be:
WELCOME TO CODER CHARTS
© CoderCharts - All Rights Reserved
Type Puzzle Pass 685 Fail 169
Scoring Language Level Easy Points 100
Tags cryptography, string manipulation

Source code editor

Unit Tests

Name CPU Unit Memory Unit

A short message

This test has at most 200 characters
1s
250 MB

A long message

This test has at most 3000 characters
1s
250 MB

Confirm that you want to switch languages
Your current edits will be lost.

Confirm that you wish to load a previous submission
Your current edits will be lost.