Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace arrange_Integer
- {
- class Program
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine().Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
- List<Number> allNumbers = new List<Number>();
- List<string> valueNumber = new List<string>(new string[] { "8", "5", "4","9","1","7","6","3","2","0" });
- var resullt = new List<string>();
- for (int i = 0; i < input.Count; i++)
- {
- Number currentNumber = new Number();
- currentNumber.NumAsString = input[i];
- if (input[0].Length==1)
- {
- currentNumber.Value = valueNumber.IndexOf(input[0]).ToString();
- }
- else
- {
- var currentNum = input[0];
- var currentNumValue = "";
- for (int j = 0; j < currentNum.Length; j++)
- {
- currentNumValue += (valueNumber.IndexOf(currentNum[j].ToString())).ToString();
- }
- currentNumber.Value = currentNumValue;
- }
- }
- foreach (var item in allNumbers.OrderBy(x=>x.Value))
- {
- resullt.Add(item.NumAsString);
- }
- Console.WriteLine(string.Join(", ",resullt));
- }
- }
- class Number
- {
- public string NumAsString { get; set; }
- public string Value { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement