kokusz19

2.zhA.C#

Dec 15th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Turastat
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. String sor;
  14. List<Turazo> lista = new List<Turazo>();
  15. while ((sor = Console.ReadLine()) != null && !sor.Equals("blablabla"))
  16. {
  17. int bennevan = 0;
  18. if (sor.Contains(":"))
  19. {
  20. continue;
  21. }
  22. else
  23. {
  24. foreach (Turazo item in lista)
  25. {
  26. if (item.nev.Equals(sor))
  27. {
  28. bennevan = 1;
  29. item.tura++;
  30. break;
  31. }
  32. }
  33. }
  34. if (bennevan == 0)
  35. {
  36. lista.Add(new Turazo(sor));
  37. }
  38. }
  39.  
  40. lista = lista.OrderBy(x => x.nev).ToList<Turazo>();
  41.  
  42. foreach (Turazo turazo in lista)
  43. {
  44. if (turazo.tura == 1)
  45. Console.WriteLine(turazo.nev);
  46. }
  47. }
  48. }
  49. class Turazo
  50. {
  51. public String nev;
  52. public int tura = 1;
  53. public Turazo(String nev)
  54. {
  55. this.nev = nev;
  56. }
  57. }
  58. }
Add Comment
Please, Sign In to add comment