Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rageQuit (input){
- let regexString = /[^0-9]+/g;
- let regexNum = /[0-9]+/g;
- input=input.shift()
- let finalString = '';
- let uniqueSymbols = {};
- let txt = input.match(regexString);
- let num = input.match(regexNum);
- for(let i = 0; i < txt.length; i++){
- if( txt !==null&& num !==null){
- let a = txt[i].toUpperCase();
- for (let el of a){
- uniqueSymbols[el] = 0;
- }
- let addToFinalString = '';
- for(let j = 1; j <= Number(num[i]); j++) {
- addToFinalString += a;
- }
- finalString += addToFinalString;
- }
- }
- let finalUniqueSymbols = Object.keys(uniqueSymbols);
- console.log(`Unique symbols used: ${finalUniqueSymbols.length}`);
- console.log(finalString);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement