RobotCommunication Problem c# Advanced Exam
Здравейте, реших задачата, но съм убедена, че може да стане с много по-малко код и linq... някой има ли жeлание да помогне ... Условието:
You will be given several input lines, consisting of encrypted messages between the robots. Read them, until you receive the command “Report”.
There are a few encoded strings in each of the messages and you must find them. After you have found such string, you have to decrypt it. Print each line immediately after you have decrypted it. The encoded string consists of – a single comma (,) or an underscore (_), a sequence of English Alphabet letters, and a digit at the end of it. Examples: “,htr7”, “_lki5”, “,edsr2“.
In order to decode a message, you have to either add or subtract the value of the digit inside the match from the ASCII code of each of the characters in the sequence. If the front character is a comma (,) you have to add the digit to the ASCII codes of the characters and if it’s an underscore (_), you must subtract it. Print the decoded words from each line separated by a single space.
ето и кода : https://pastebin.com/R3AwYVFN
Може ле да се използват функциите за добавяне или изваждане на символи директно с linq, например думата да се превърне в list<char> и с един forech да се променят символите? Опитах се, но нещо не успявам....