36.0k views
0 votes
Given two strings s1 and s2 of same length.Create a new string consisting of the last character of s1 followed by the last character of s2, followed by the second to last character of s1, followed by the second to last character of s2, and so on (in other words the new string should consist of alternating characters of the reverse of s1 and s2).For example,if s1="hello" and s2="world", then s3 should be "odlllreohw"Associate the new string with the variable s3.

User LeeJB
by
5.4k points

1 Answer

3 votes

The answer & explanation for this question is given in the attachment below.

Given two strings s1 and s2 of same length.Create a new string consisting of the last-example-1
Given two strings s1 and s2 of same length.Create a new string consisting of the last-example-2
User Mljrg
by
5.9k points