Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of this exercise is to decode a hidden message. To find this message, you have two information: - A character string containing letters

image text in transcribed

The purpose of this exercise is to decode a hidden message. To find this message, you have two information: - A character string containing letters = the encoded message - A sequence of numbers = the key to the message

The goal is to reconstruct the hidden message using these two information. The key to the message gives us the order of the letters of the message and also the index of the matching character in the character string.

Notes: - You must verify that the length of the character string doesn't exceed 9. If the length exceeds 9, print "Impossible to decode the message". - All the characters of the character string must be different from one another. - The space is considered as a character.

The program must show:

Example 1: Enter the encoded message: abcdefghijklmnop Enter the key to the message: 123456789 Impossible to decode the message

Example 2: Enter the encoded message: nbjoru Enter the key to the message: 2413465 The message decoded is : bonjour

Example 2 in details:

If we break down the key of the message, We find: 2=Gives us the 2nd character of the encoded message=b 4=Gives us the 4th character of the encoded message=o 1=Gives us the 1st character of the encoded message=n 3=Gives us the 3rd character of the encoded message=j 4=Gives us the 4th character of the encoded message=o 6=Gives us the 6th character of the encoded message=u 5=Gives us the 5th character of the encoded message=r This gives us the encoded message "bonjour".

Le but de cet exercice est de dcoder un message cach. Pour trouver ce message, vous disposez de deux informations : Une chane de caractres contenant des lettres de l'alphabet: la chane encode. Une suite de nombres : la cl du message. L'objectif est de reconstituer le message cach l'aide de ces deux informations. La cl du message donne la fois l'ordre des lettres du message, mais galement l'index du correspondant dans la chane encode. Remarques : Vous devez vrifier que la taille de la chane encode ne dpasse pas 9. Si la taille est suprieure 9, afficher dans la console Impossible de dcoder la chane". Tous les caractres de la chane encode doivent tre diffrents les uns des autres. L'espace est considr comme un caractre. Dans la console, votre programme devrait donner : Exemple 1: Entrez la chane encode : abcdefghijklmnop Entrez la cl du message : 123456789 Impossible de dcoder la chane Exemple 2: Entrez la chane encode : nbjoru Entrez la cl du message : 2413465 La chane dcode donne : bonjour

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

ISBN: 1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

What accommodations might be helpful?

Answered: 1 week ago