Ultraviolet A 458-the decoder

Source: Internet
Author: User
The decoder

Write a complete program that will correctly decode a set of characters into a valid message. your program shocould read a given file of a simple coded set of characters and print the exact message that the characters contain. the code key for this simple coding is a one for one character substitution based uponSingle arithmetic manipulationOf the printable portion of the ASCII character set.

 

Input and Output

For example: with the input file that contains:

 

1JKJ‘pz‘{ol‘{yhklthyr‘vm‘{ol‘Jvu{yvs‘Kh{h‘Jvywvyh{pvu51PIT‘pz‘h‘{yhklthyr‘vm‘{ol‘Pu{lyuh{pvuhs‘I|zpulzz‘Thjopul‘Jvywvyh{pvu51KLJ‘pz‘{ol‘{yhklthyr‘vm‘{ol‘Kpnp{hs‘Lx|pwtlu{‘Jvywvyh{pvu5

Your program shocould print the message:

*CDC is the trademark of the Control Data Corporation.*IBM is a trademark of the International Business Machine Corporation.*DEC is the trademark of the Digital Equipment Corporation.

Your program shocould accept all sets of characters that use the same encoding scheme and shocould print the actual message of each set of characters.

 

Sample Input

 

1JKJ‘pz‘{ol‘{yhklthyr‘vm‘{ol‘Jvu{yvs‘Kh{h‘Jvywvyh{pvu51PIT‘pz‘h‘{yhklthyr‘vm‘{ol‘Pu{lyuh{pvuhs‘I|zpulzz‘Thjopul‘Jvywvyh{pvu51KLJ‘pz‘{ol‘{yhklthyr‘vm‘{ol‘Kpnp{hs‘Lx|pwtlu{‘Jvywvyh{pvu5

 

Sample output

 

*CDC is the trademark of the Control Data Corporation.*IBM is a trademark of the International Business Machine Corporation.*DEC is the trademark of the Digital Equipment Corporation.
1 // the sample has already been told. Reduce the output by 7 to 2 // because space needs to be read, it is not recommended to use CIN >>, and it should be changed to getchar (); 3 // the following code: 4 # include <iostream> 5 # include <string. h> 6 # include <stdio. h> 7 # include <ctype. h> 8 # include <algorithm> 9 # include <stack> 10 # include <queue> 11 # include <set> 12 # include <math. h> 13 # include <vector> 14 # include <map> 15 # include <deque> 16 # include <list> 17 using namespace STD; 18 int main () 19 {20 char ch; 21 While (~ (CH = getchar () 22 putchar (CH = '\ n '? '\ N': ch-7); 23 return 0; 24}
View code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.