Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let uniqueSymbols = [...new Set(input[0].match(/[^0-9]/g).map((x) => x.toUpperCase()))];
- let series = input[0].split(/[0-9]+/).filter((x) => x != "");
- let repeaters = input[0].split(/[^0-9]+/).filter((x) => x != "");
- console.log(`Unique symbols used: ${uniqueSymbols.length}`);
- let result = "";
- for (let i = 0; i < series.length; i++) {
- result += series[i].toUpperCase().repeat(repeaters[i]);
- }
- console.log(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement