Introduction
Let's say that S1 = a...b
and S2 = ..c..
. If we place them on top of each other, we get:
a...b
..c..
We merge both strings, with the .
as the liquid character (which can overlapped). We get this:
a.c.b
If one of the string is longer than the other, we just apply the same algorithm:
a.....b
..c..
becomes:
a.c...b
and
a.....b
..c.......
becomes:
a.c...b...
If two characters collide, we just use the bottom character, e.g.
a..b
...c
becomes:
a..c
The Task
Given two non-empty strings, output the merged string. Note, you can assume that the input only contains periods and lowercase letters (or uppercase letters if that is more convenient).
Test cases
Input Output
a....b ..c... a.c..b
aaaaaa bbbbbb bbbbbb
ab.ab. b.b.b. bbbab.
a.......b c c.......b
This is code-golf, so the submission with the least amount of bytes wins!
a.....b
..c.......
possible? What's the output then? \$\endgroup\$a.c...b...
. \$\endgroup\$