Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let pattern = /::([A-Z][a-z]{2,})::|\*\*([A-Z][a-z]{2,})\*\*/g;
- let matches = 0;
- for (let line of input) {
- let matches = line.match(pattern);
- }
- let decimalPattern = /\d/g;
- let treshold = 0;
- decimalPattern.forEach(element => {
- treshold += Number(element);
- });
- let coolEmojCount = 0;
- let coolEmojis = 0;
- for (const match of matches) {
- let sum = 0;
- for(let i = 0; i < match.length; i++) {
- sum += match.charCodeAt(i);
- }
- if (sum > treshold) {
- coolEmojCount++;
- coolEmojis.push(match);
- }
- }
- Console.log('Cool treshold: $n$coolEmojiCount');
- Console.log('$matches.count() emojis found in the text. The cool ones are:%n')
- for (const iterator of coolEmojis) {
- Console.log(iterator);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement