Recursive interleaving of strings X61846


Statement
 

pdf   zip

The interleaving of two strings xx and yy is a string that contains all characters of xx and yy and preserves the relative order of the characters in both xx and yy. For example, the interleaving of abcabc and xyzxyz is axbyczaxbycz. Write a program that prints the interleaving of every given pair of strings.

Define and use a recursive function

interleaving(x,y)

that returns the interleaving of two strings xx and yy.

Input

The input consists of several pairs of strings.

Output

Print the interleaving of every given pair of strings.

Public test cases
  • Input

    abc xyz
    ab xyz
    abc xy
    

    Output

    axbycz
    axbyz
    axbyc
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Official solutions
    Python
    User solutions
    Python