Hide

Problem F
Interleave Two Files

Write a program that reads two text files and prints out their lines interleaved. The two files do not necessarily have to have the same number of lines.

See the files under Attachments.

Input

Input consists of two lines:

  1. The filename of the first file,

  2. and the filename of the second file.

Output

Output consists of the interleaved content of the two files, where each line from the first file is followed by a line from the second file, if available.

Sample Input 1 Sample Output 1
a.txt
b.txt
My name is Jonas
Low
I live in a whale
High
It's quite cozy
Midlake
Timbre Timbre
Sample Input 2 Sample Output 2
c.txt
a.txt
1
My name is Jonas
2
I live in a whale
3
It's quite cozy
4
5

Please log in to submit a solution to this problem

Log in