Question: write a function called strexpand which accepts string of where letters are all grouped together ( like aaee or bbccdd ) and returns a new

write a function called strexpand which accepts string of where letters are all grouped together (like aaee or bbccdd) and returns a new strings with each letter followed by a count of a the number of times it appears. For instance, given the input "aaee" you would return "a2e2"strExpand
Write a function called strexpand which accepts string of where letters
are all grouped together (like aaee or bbccdd) and returns a new string
with each letter followed by a count of a the number of times it
appears. For instance, given the input "aaee" you would return
"a2e2".
Hint: using an object to keep track of each letter and the number
of times it appears will be very helpful.
Examples:
strExpand('aeebbccd')??'a1e2b2c2d1'
strExpand(apple);??a1p2l1e1
strExpand(pppaaalll);??o2p3a4l.3
strExpand(bbccdd);??b2c2d2
1> 'use strict'; dots
/*
Complete the 'strexpand' function below.
The function is expected to return a STRING,
The function accepts STRING str as parameter.
***?
function strexpand(str){
}
> function main()
Test Results
Custom Input
Visual Format
Raw Format
Debug function strexpand with your own input
String str
 write a function called strexpand which accepts string of where letters

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!