fork(1) download
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var s = @"ir KAS gi mus nugales.
  12. jei! mes MIRTI NEBIJOM,
  13. JEIGU mes nugalejom mirti
  14. DZUKAS";
  15. var res = new List<string>();
  16. using (var sr = new StringReader(s)) {
  17. var line = "";
  18. while ((line=sr.ReadLine()) != null) {
  19. var match = Regex.Matches(line, @"\b\p{Lu}+\b").Cast<Match>().LastOrDefault();
  20. if (match != null) res.Add(match.Value);
  21. }
  22. }
  23. foreach (var v in res)
  24. Console.WriteLine(v);
  25. }
  26. }
Success #stdin #stdout 0.04s 30096KB
stdin
Standard input is empty
stdout
KAS
NEBIJOM
JEIGU
DZUKAS