Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let arr = gets();
- let numberOfWords = Number(gets());
- let word = gets();
- let index = arr.lastIndexOf(word);
- let position = Math.ceil((index + 1) / numberOfWords);
- if (index !== -1) {
- print(position);
- } else {
- print(index);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement