Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function serializeString(input) {
- let indexes = [];
- for (let i = 0; i < input.length; i++) {
- let currentLetter = input[i];
- for (let j = 0; j < input.length; j++) {
- if (currentLetter === input[j]) {
- indexes.push(j)
- }
- }
- console.log(`${currentLetter}:${indexes.join('/')}`);
- indexes = [];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment