Задача 02. Spy Gram от Fundamentals Exam 09.05.2017 - малко помощ...
Здравейте, трябва проверка ,но явно не мога да включа .. и ми дава само 40..
Моля, за съвет ? Ето и кода:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace _02.Spy_Gram
{
class Program
{
static void Main(string[] args)
{
var key = Console.ReadLine();
var pattern = @"^(TO)\:\s([A-Z]+)\;\s(MESSAGE)\:\s(.+)\;$";
var inputLine = Console.ReadLine();
var output=new List<string>();
var outputEncrypt = new List<string>();
Regex regex= new Regex(pattern);
while (inputLine !="END")
{
var messages = regex.Match(inputLine);
if (regex.IsMatch(inputLine))
{
output.Add(inputLine);
}
inputLine = Console.ReadLine();
}
var outputForEncoding = output.OrderBy(x => x).ToList();
for (int i = 0; i < outputForEncoding.Count; i++)
{
var curentWord = "";
var c = 0;
for (int j = 0; j < outputForEncoding[i].Length; j++)
{
char leter = (char)(outputForEncoding[i][j] + int.Parse(key[c].ToString()));
if ((int)(leter) > 126)
{
leter = (char) ((int)(leter) - 126+32-1);
}
curentWord = curentWord + leter;
if (c == key.Length - 1) c = -1;
c++;
}
outputEncrypt.Add(curentWord);
}
for (int i = 0; i < outputEncrypt.Count; i++)
{
Console.WriteLine(outputEncrypt[i]);
}
}
}
}