Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _04.ArrayHistogram
- {
- class ArrayHistogram
- {
- static void Main(string[] args)
- {
- var input = Console.ReadLine().Split().ToArray();
- var words = new List<string>();
- var occurrencesCount = new List<int>();
- int count = 1;
- for (int i = 0; i < input.Length; i++)
- {
- if (!words.Contains(input[i]))
- {
- words.Add(input[i]);
- occurrencesCount.Insert(i,count);
- }
- else if (words.Contains(input[i]))
- {
- occurrencesCount.Insert(//??, count++);
- }
- }
- Console.WriteLine(string.Join(" ", words));
- Console.WriteLine(string.Join(" ", occurrencesCount));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement