fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string input = " aa aaa aaaa bb bbb bbbb cc ccc cccc cccc ";
  9. var words = input.Split((char[])null, StringSplitOptions.RemoveEmptyEntries).Distinct();
  10. var lookup = words.ToLookup(s => s.Length);
  11. foreach (var group in lookup)
  12. {
  13. Console.WriteLine(string.Join(", ", group.ToArray()));
  14. }
  15. }
  16. }
Success #stdin #stdout 0.05s 37176KB
stdin
Standard input is empty
stdout
aa, bb, cc
aaa, bbb, ccc
aaaa, bbbb, cccc