Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(arr) {
- text = arr[0].replace(/[a-z]/ig, (m) => m.toUpperCase());
- const uniqueChars = new Set(text.match(/[^\d]/g));
- console.log(`Unique symbols used: ${uniqueChars.size}`);
- let result = [];
- for (const e of [...text.matchAll(/(?<chrs>[^\d]+)(?<n>\d+)/g)]) {
- const {chrs, n} = e.groups;
- result.push(chrs.repeat(Number(n)));
- }
- console.log(result.join(''));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement