Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. List<double> numbers = Console.ReadLine().Split(' ').Select(double.Parse).ToList();
  2. var counts = new SortedDictionary<double, int>();
  3. foreach (var num in numbers)
  4. {
  5. if (counts.ContainsKey(num))
  6. {
  7. counts[num]++;
  8. }
  9. else {
  10. counts[num] = 1;
  11. }
  12. }
  13. foreach (var num in counts)
  14. {
  15. Console.WriteLine("{0} -> {1}",num.Key,num.Value);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement