<< PrevALCON PROBLEM 5:
SUPERMARKET SUBTERFUGE
Week 4 asked you to write a program that allows Toby Strak to keep track of all the Nickel Man suits in the facility by introducing the data into an array. IIf you missed this problem, you can always do them in your spare time and get feedback in your code.
You can find the sample answer to Week 4's problem, as well as everything Week 4 related
here.
Please make sure you've read the rules
here.
Week 5 question:The two supermarket giants, Kohls and Fleecies, are in kahoots with each other. With new competitors, BELDI and YGA entering the market, they’re determined to keep their current power. To prevent the government from getting suspicious, Kohls and Fleecies send each other coded messages every day.
The real message is deciphered by taking the first two characters of each word in the coded message and putting them together. E.g. ‘Blizzard ueda Location tuesday sTorm entraps Top nine ghurkas t.’ → ‘BlueLotusTenTonight.’
Write a program that can decode the messages. It should accept the encrypted string as an input parameter, and return a decrypted string in the output.
Notes: In pseudocode (which is a little outdated at times), strings are arrays of characters. A “word” is separated by a space on both sides (unless it’s the first or last word, in which case there’s only one space on the right or left or it).
Optional challenge add-on (+2 marks)
You’ve figured out how to intercept the messages before they reach the other party. Sabotage them by deleting every other word in the string.
You’ll be marked on correctness, efficiency, and defensive programming.
Learning objectives for the week:-> String manipulation.
Don't forget to
login or
register an account to submit your answer!
Good luck, and as always, happy algorithming!