Re-Arrange String in sequence order

Give an string ‘abcd’ and an another string ‘efghij’, print the sequence in alternate order, if any of the string is ended, append the rest of the string to the other string Input :  abcd , efghij Output: aebfcgdhij Code: