fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. static void Main(string[] args)
  8. {
  9. var strwords = getLastWord("write LINQ queries to do THE following TASK");
  10. foreach (string str in strwords)
  11. Console.WriteLine(str);
  12. Console.ReadLine();
  13. }
  14.  
  15. static IEnumerable<string> getLastWord(string str)
  16. {
  17. var upper = str.Split(' ')
  18. .Where(s => String.Equals(s, s.ToUpper(),
  19. StringComparison.Ordinal)).Reverse().Take(1);
  20.  
  21. return upper;
  22.  
  23. }
  24. }
Success #stdin #stdout 0.04s 24040KB
stdin
Standard input is empty
stdout
TASK