Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace CharRotation
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- string text = Console.ReadLine();
- List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<char> result = new List<char>();
- for (int i = 0; i <numbers.Count ; i++)
- {
- if(numbers[i] % 2 == 0)
- {
- int value = (int) text[i] - numbers[i];
- char resultValue = (char)value;
- result.Add(resultValue);
- }
- else
- {
- int value = (int)text[i] + numbers[i];
- char resultValue = (char)value;
- result.Add(resultValue);
- }
- }
- Console.WriteLine(string.Join("",result));
- }
- }
- }
Add Comment
Please, Sign In to add comment