Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions