Let's say that S1 =
a...b and S2 =
..c... If we place them on top of each other, we get:
We merge both strings, with the
. as the liquid character (which can overlapped). We get this:
If one of the string is longer than the other, we just apply the same algorithm:
a.....b ..c.. becomes: a.c...b
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
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).
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!