Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. // CodeEval.com
  2. // Medium - First Non-Repeated Character
  3. // Score: 56.158
  4.  
  5. using System;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text.RegularExpressions;
  9.  
  10. class Program
  11. {
  12. static int Main(string[] args)
  13. {
  14. using (StreamReader reader = File.OpenText(args[0]))
  15. {
  16. while (!reader.EndOfStream)
  17. {
  18. var line = reader.ReadLine();
  19.  
  20. var result = line.ToCharArray().GroupBy(l => l).Where(l => l.Count() == 1).Select(l => l.Key);
  21.  
  22. Console.WriteLine(result.First());
  23. }
  24. }
  25. return 0;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement