Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace apps
- {
- class Program
- {
- static void Main()
- {
- //append arrays
- string input = Console.ReadLine();
- input = RemoveWhitespace(input); //remove whitespaces
- List<string> arrays= input.Split('|').ToList(); // split into arrays
- for (int i = 0; i < arrays.Count; i++) // pick every arrays and sort it
- {
- int[] numbersofIndex = new int[arrays[i].Length];
- for (int x = 0; x < arrays[i].Length; x++)
- {
- string thisString = arrays[i];
- numbersofIndex[x] = Convert.ToInt32(thisString[x].ToString());
- }
- arrays[i] = string.Empty;
- arrays[i] = string.Join(' ', numbersofIndex);
- }
- for (int i = arrays.Count-1; i>=0; i--) // print in reverse order
- Console.Write(arrays[i] + " ");
- }
- static string RemoveWhitespace(string input)
- {
- string newstring = string.Empty;
- foreach(char c in input)
- {
- if (c !=' ') { newstring += c.ToString(); }
- }
- return newstring;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement