Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- class Program
- {
- static void Main()
- {
- string secretWord = Console.ReadLine();
- string encryptedMessage = Console.ReadLine();
- int result = 0;
- int mask = 0;
- foreach (char c in secretWord)
- {
- if (c > 0 || c <= 99)
- {
- mask += c % 10 + c / 10;
- }
- else if (c >= 100 || c <= 999)
- {
- int edinici = c % 10;
- int desetici = (c - (c % 10)) / 100;
- int stotici = c / 100;
- mask += edinici + desetici + stotici;
- }
- }
- for (int i = 0; i < encryptedMessage.Length; i++)
- {
- foreach (char a in encryptedMessage)
- {
- result += a;
- if (i % mask == 0)
- {
- result += mask;
- }
- else
- {
- result -= mask;
- }
- }
- }
- Console.WriteLine(Convert.ToChar(result));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement