Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function main (lines) {
- let text = lines[0].toLowerCase();
- let word = lines[1].toLowerCase();
- let index = text.indexOf(word);
- let counter = 0;
- while (index != -1) {
- counter++;
- index = text.indexOf(word ,index + 1);
- }
- console.log(counter);
- }
- let lines = ['ababa caba', 'aba'];
- main(lines);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement