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;
- namespace C4USE2012
- {
- class Program
- {
- static void Main(string[] args)
- {
- int value, l = 0, N;
- int[,] count = new int[12, 1];
- string[] words;
- string[] months = { "января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря" };
- string[] factMonths = { "январь", "февраль", "март", "апрель", "май", "июнь", "июль", "август", "сентябрь", "октябрь", "ноябрь", "декабрь" };
- string s;
- char separator = ' ';
- N = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < N; i++)
- {
- s = Console.ReadLine();
- words = s.Split(separator);
- for (int k = 0; k < 12; k++)
- {
- foreach (string word in words)
- {
- if (word == months[k]) count[k, 0]++;
- }
- }
- }
- s = null;
- words = null;
- value = count[0, 0];
- for (int i = 0; i < 12; i++)
- {
- for (int j = 0; j < 12; j++)
- {
- if (count[j, 0] > value)
- {
- value = count[j, 0];
- l = j;
- }
- }
- if (value != 0) Console.WriteLine(factMonths[l] + ' ' + value);
- value = 0;
- count[l, 0] = 0;
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement