Guest User

Untitled

a guest
Sep 15th, 2019
92
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class WeightSort
  6. {
  7. public static string orderWeight(string strng)
  8. {
  9. var weights = strng.Split(' ')
  10. .OrderBy(num => num.Sum(x => (int)char.GetNumericValue(x)))
  11. .ThenBy(num => num);
  12.  
  13. return String.Join(" ", weights);
  14. }
  15. }
RAW Paste Data