fork(22) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. foreach (var v in Split("abcdefghij"))
  10. {
  11. Console.WriteLine(v);
  12. }
  13. }
  14. static IEnumerable<string> Split(string str)
  15. {
  16. while (str.Length > 0)
  17. {
  18. yield return new string(str.Take(3).ToArray());
  19. str = new string(str.Skip(3).ToArray());
  20. }
  21. }
  22. }
Success #stdin #stdout 0.03s 33928KB
stdin
Standard input is empty
stdout
abc
def
ghi
j