Question: Write the function that takes one parameter, a non-empty String str (such as Code) and returns a String in the form CCoCodCode. Notice that this

Write the function that takes one parameter, a non-empty String str (such as "Code") and returns a String in the form "CCoCodCode". Notice that this includes the first character of the original String, followed by the first twocharacters, and so on until the whole String is used.

Here are some examples:

stringSplosion("Code") returns "CCoCodCode"

stringSplosion("abc") returns "aababc"

stringSplosion("x") returns "x"

I believe the for condition is ( int i = 0 ; i < len ; i++), but I don't know how to continue.

Please use a for loop and if you can explain cause I'm a beginner

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!