-
-
Save Cool-sami12/d2957e40286928f54e0cbd1970131ee5 to your computer and use it in GitHub Desktop.
Monk Takes a Walk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Sample code to perform I/O: | |
| process.stdin.resume(); | |
| process.stdin.setEncoding("utf-8"); | |
| var stdin_input = ""; | |
| process.stdin.on("data", function (input) { | |
| stdin_input += input; // Reading input from STDIN | |
| }); | |
| process.stdin.on("end", function () { | |
| main(stdin_input); | |
| }); | |
| // Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail | |
| // Write your code here | |
| function main(input) { | |
| const lines = input.split('\n'); // ['nBBZLaosnm', 'JHkIsnZtTL'] | |
| const numOfTests = lines.shift(); // 2 | |
| const vowels = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u']; | |
| lines.forEach((trees) => { | |
| const treesWithVowels = trees.split('').filter((tree) => { | |
| return vowels.includes(tree); | |
| }); // [ 'a', 'o'] | |
| console.log(treesWithVowels.length); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment