Advertisement
YavorGrancharov

Char_Rotation

Jun 20th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Char_Rotation
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var chars = Console.ReadLine()
  14.                 .ToCharArray();
  15.  
  16.             var numbers = Console.ReadLine()
  17.                 .Split(new char[] { ' ' },
  18.                 StringSplitOptions.RemoveEmptyEntries)
  19.                 .Select(int.Parse)
  20.                 .ToArray();
  21.  
  22.             string empty = string.Empty;
  23.  
  24.             for (int i = 0; i < numbers.Length; i++)
  25.             {
  26.                 if (numbers[i] % 2 == 0)
  27.                 {
  28.                     empty += (char)(chars[i] - numbers[i]);
  29.                 }
  30.                 else
  31.                 {
  32.                     empty += (char)(numbers[i] + chars[i]);
  33.                 }
  34.             }
  35.             Console.WriteLine(empty);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement