Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Messaging
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> numbers = Console.ReadLine()
- .Split(' ', StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- int[] output = new int[numbers.Count];
- for (int i = 0; i < numbers.Count; i++)
- {
- int sum = 0;
- int current = int.Parse(numbers[i]);
- for (int j = 0; j < numbers[i].Length; j++)
- {
- sum += current % 10;
- current /= 10;
- }
- output[i] = sum;
- }
- string text = Console.ReadLine();
- for (int i = 0; i < output.Length; i++)
- {
- while (output[i] >= text.Length)
- {
- output[i] -= text.Length;
- }
- Console.Write($"{text[output[i] + i]}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement