fork(37) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5.  
  6. public static class Test
  7. {
  8. private static IEnumerable<string> GraphemeClusters(this string s) {
  9. var enumerator = StringInfo.GetTextElementEnumerator(s);
  10. while(enumerator.MoveNext()) {
  11. yield return (string)enumerator.Current;
  12. }
  13. }
  14. private static string ReverseGraphemeClusters(this string s) {
  15. return string.Join("", s.GraphemeClusters().Reverse().ToArray());
  16. }
  17.  
  18. public static void Main()
  19. {
  20. var s = "Les Mise\u0301rables";
  21. var r = s.ReverseGraphemeClusters();
  22. Console.WriteLine(r);
  23. }
  24. }
Success #stdin #stdout 0.03s 33960KB
stdin
Standard input is empty
stdout
selbarésiM seL