The gnat compiler for Ada has been installed on Burnsville. Here is a brief set of instructions for compiling a simple procedure or function (something that is not part of a package and does not use multiple tasks).
To complete this assignment, you will need to use conditionals (if, case), loops, CHARACTER manipulation, VAL and POS, and subprograms.
Congratulations. You have been recruited by the CIA as senior programmer, and your first assignment is to decode messages that have been intercepted from the Albanian Secret Service (ASS). You know that ASS always encodes messages by first "rotating" all letters forward by some number N positions, then by rotating the upper case vowels one position forward and the lower case vowels one position backwards (see below).
(vowel rotations) change 'A' and 'a' to 'E' and 'u' respectively change 'E' and 'e' to 'I' and 'a' respectively change 'I' and 'i' to 'O' and 'e' respectively change 'O' and 'o' to 'U' and 'i' respectively change 'U' and 'u' to 'A' and 'o' respectively
A →E | E →I | I →O | O →U | U →A |
a →u | e →a | i →e | o →i | u →o |
The Plane Leaves At 10:00PM.may be encoded using a shift of 10 letter positions (so 'A' becomes 'K') followed by the vowel shift, which would give
Dri Zvkxi Vikfic Kd 10:00ZW.Note that a shift of a letter past 'Z' causes it to be shifted to the front, e.g., 'S' shifted by 10 gives 'C'. Also note that the encoding does not change the case of a letter (upper or lower).
One last piece of information: ASS messages always begin with the same word, "Agent" e.g.,
Agent #12345: Please return to HQ ASAP.Knowing that the first word of a message is always Agent allows you to determine the overall letter shift, N, for that message.
Write a program which decodes a message and writes the decoded message to the output.
Your program should read the encoded message from the "standard" input. When you test your program, use UNIX I/O redirection...e.g.,
$ myprog < message1.txt > message1.out
Your program should translate the message, character by character, and print it to the standard output.