Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const input = [
- ['Telerik', 'Java', 'CSS', 'JavaScript', 'PHP', 'HTML', 'CSS', 'Spring', 'Angular'],
- '2',
- 'CSS'
- ];
- const print = this.print || console.log;
- const gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
- const arr = gets();
- const words = +gets();
- const keyword = gets();
- let index = -1;
- for (let i = 0; i < arr.length; i++) {
- if (arr[i] == keyword) {
- index = i;
- }
- }
- if (index > -1) {
- let page = Math.ceil((index + 1) / words);
- print(page);
- } else {
- print(-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment