Advertisement
Aborigenius

StringDecryption-ConvertToChar

Aug 15th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 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 StringDecryption
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] mn = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  14.             int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  15.  
  16.             List<int> filtered = new List<int>();
  17.             for (int i = 0; i < array.Length; i++)
  18.             {
  19.  
  20.                 if (array[i] >= 65 && array[i] <= 90)
  21.                 {
  22.                     filtered.Add(array[i]);
  23.                 }
  24.             }
  25.             int skip = mn[0];
  26.             int take = mn[1];
  27.  
  28.             List<int> secondFilter = filtered.Skip(skip).Take(take).ToList();
  29.  
  30.     //        Console.WriteLine($"Filtered: {string.Join(" ", filtered)}");
  31.     //        Console.WriteLine($"Second: {string.Join(" ", secondFilter)}");
  32.  
  33.             foreach (var chars in secondFilter)
  34.             {
  35.                 Console.Write(Convert.ToChar(chars));
  36.             }
  37.  
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement