Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _5._PageCalculator
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> words = Console.ReadLine()
- .Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- double wordsPerPage = double.Parse(Console.ReadLine());
- string keyword = Console.ReadLine();
- if (words.Contains(keyword))
- {
- int position = words.LastIndexOf(keyword);
- double output = Math.Ceiling(++position / wordsPerPage);
- Console.WriteLine(output);
- }
- else
- {
- Console.WriteLine("-1");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment