[Question]
  [
### 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](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the submission with the least amount of bytes wins!
  
[Answer]
## CJam, 9 bytes
```
leul.e>el
```
[Test it here.](http://cjam.aditsu.net/#code=leul.e%3Eel&input=ab.ab.%0Ab.b.b.c)
### Explanation
Makes use of the fact that `'.' < upper case letters < lower case letters`. This way, when taking the element-wise maximum between two strings, any letter overrides a `.`, but we can make a letter from the second input override a letter from the first if we upper case the first. Confusing? Here's one of the test cases as an example:
```
ab.ab.
b.b.b.
```
Convert first to upper case:
```
AB.AB.
b.b.b.
```
Take the element-wise maximum:
```
bBbAb.
```
Convert back to lower case:
```
bbbab.
```
And here is how the code does that:
```
l    e# Read first line.
eu   e# Convert to upper case.
l    e# Read second line.
.e>  e# Take element-wise maximum. If the lengths are different, the additional elements
     e# from the longer list are just appended.
el   e# Convert back to lower case.
```
[Answer]
## [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
Œu»Œl
```
Input via command-line arguments.
[Try it online!](http://jelly.tryitonline.net/#code=xZJ1wrvFkmw&input=&args=YWIuYWIu+Yi5iLmIuYw)
### Explanation
This is a direct port of [my CJam answer](https://codegolf.stackexchange.com/a/74810/8478) (see that for an explanation why this works):
```
Œu     # Convert first argument to upper case.
  »    # Element-wise maximum between both strings.
   Œl  # Convert result back to lower case.
```
[Answer]
# Javascript ES6, ~~52~~ 55 chars
```
(a,b)=>b.replace(/\./g,(m,i)=>a[i]||m)+a.slice(b.length)
```
Test
```
f=(a,b)=>b.replace(/\./g,(m,i)=>a[i]||m)+a.slice(b.length)
;`
a....b ..c...      a.c..b
aaaaaa bbbbbb      bbbbbb
ab.ab. b.b.b.      bbbab.
a.......b c        c.......b
c a....b           a....b
`.split('\n').filter(Boolean).map(s=>s.split(/\s+/)).every(a=>f(a[0],a[1])==a[2])
```
[Answer]
# Pyth, 11
```
smenD\.d.TQ
```
[Try it online](http://pyth.herokuapp.com/?code=smenD%5C.d.TQ&input=%22a...d.b%22%2C%22b.c..%22&debug=0) or run the [Test Suite](http://pyth.herokuapp.com/?code=smenD%5C.d.TQ&input=%22a...d.b%22%2C%22b.c..%22&test_suite=1&test_suite_input=%22a....b%22%2C%22..c...%22%0A%22aaaaaa%22%2C%22bbbbbb%22%0A%22ab.ab.%22%2C%22b.b.b.%22%0A%22a.......b%22%2C%22c%22&debug=0)
[Answer]
## Seriously, 10 bytes
```
,û,Z`M`MΣù
```
[Try it online!](http://seriously.tryitonline.net/#code=LMO7LFpgTWBNzqPDuQ&input=J2FiLmFiLicKJ2IuYi5iLic)
Uses the same strategy as [Martin's CJam answer](https://codegolf.stackexchange.com/a/74810/45941)
Explanation:
```
,û,Z`M`MΣù
,û          get first string, uppercase
  ,Z        get second string, zip with first string
    `M`M    map maximum
        Σù  join and uppercase
```
[Answer]
# Octave, 50 bytes
```
function c=m(a,b)c=b;c(a>0)=a;i=b>46;c(i)=b(i);end
```
[Answer]
## Haskell, ~~43~~ 42 bytes
```
(a:b)#(c:d)|c<'a'=a:b#d|1<2=c:b#d
a#b=a++b
```
Usage example: `"ab.ab." # "b.b.b."` -> `"bbbab."`.
How it works:
* if both list are non-empty, pick the the head of the 1st list if the head of the 2nd list is `"."`, else pick the head of the second list. Append a recursive call with the tails of the lists.
* if at least one list is empty, append both lists.
Edit: @Lynn saved a byte. Thanks!
[Answer]
# Python 2, 47 bytes
```
lambda s,t:`map(max,s.upper(),t)`[2::5].lower()
```
[Answer]
# Julia, 101 bytes
```
f(s,t,r=i->rpad(i,max((n=endof)(s),n(t)),"."))=join([min(a,b)<90?max(a,b):b for(a,b)=zip(r(s),r(t))])
```
This is a function that accepts two strings and returns a string.
We compute `m` as the maximum length of the two inputs, then define a function `r` that right pads its input with `.`s to length `m` and store that as a function argument. We then `zip` the right padded inputs and check the minimum (as defined by the ASCII code) of each pair. If it's a `.`, we use whichever character has the bigger code, otherwise we use whichever came from the second input. The resulting array is `join`ed into a string and returned.
[Answer]
# C, ~~106~~ 89 bytes
```
i,j,k;f(s,z)char*s,*z;{for(i=0,j=k=1;j|k;i++)putchar((k=k?z[i]:0)>46|!(j=j?s[i]:0)?k:j);}
```
Test live on [**ideone**](http://ideone.com/qeMuFK).
[Answer]
# [Retina](http://github.com/mbuettner/retina), 55
```
$
 
+`(.?(\S* )(\w)|(\S)(\S* ).?)(\S* .*)
$2$5$6$3$4
 
```
Line 5 is a single space. Line 6 is an empty line (with no trailing newline).
[Try it online.](http://retina.tryitonline.net/#code=JAogCitgKC4_KFxTKiApKFx3KXwoXFMpKFxTKiApLj8pKFxTKiAuKikKJDIkNSQ2JDMkNAogCg&input=YS4uLi4uLi5iIGM)
I started this one in GNU sed, (with the -r option). Straightforward port to Retina once I got the regexes figured out. The sed version is:
```
s/$/ /
:
s/(.?(\S* )(\w)|(\S)(\S* ).?)(\S* .*)/\2\5\6\3\4/
t
s/ *//
```
[Answer]
# Python 2, 70 bytes
```
lambda x,y:"".join([k if k!="."and k else j for j,k in map(None,x,y)])
```
[Try it here!](https://repl.it/BtHT/3)
First we create zip both strings into one list. If the second string is longer than the first, it is padded with `None` (`map(None,x,y)` does that).  
Then we iterate over this list with `j` being the character from the first string and `k` the one from the second string. We choose `k` if it's not a dot and otherwise `j`.
This could be 61 bytes if I could output the result as list of characters instead of a string.
[Answer]
# Perl, 48 + 3 = 51 bytes
```
s/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.
```
Bah cannot find a shorter solution. (Same approach as @Qwertiy's JavaScript's answer).  
Requires `-pl` and takes input from `stdin` and `-i`
```
$ perl -i'a...ce' -ple's/\./substr($^I,$.=pos,1)||$&/ge;$_.=substr$^I,$.' <<< '..b.d..f'
a.b.de..f
```
[Answer]
# PHP>=7.1, 58 Bytes
```
for([,$x,$y]=$argv;~$c=$y[$i++];)$c<_?:$x[$i-1]=$c;echo$x;
```
[Online Version](http://sandbox.onlinephpfunctions.com/code/e1e60f860f4e7a5cea314496f5abfb3f7c09a3c3)
[Answer]
# q/kdb+, ~~43~~ 40 bytes
**Solution:**
```
lower{l:max(#:)each(x;y);upper[l$x]|l$y}
```
**Example:**
```
q)lower{l:max(#:)each(x;y);upper[l$x]|l$y}["a..b..";"...c"]
"a..c.."
```
**Explanation:**
```
(#:)                // k equivalent of count
max (#:) each(x;y)  // takes each string, count the length, return maximum
l$x                 // whites-space pad string x to length l
|                   // take the maximum (per Martin's strategy)
upper[...]          // convert padded string 1 to uppercase
lower{...}          // convert result of function to lowercase
```
**Notes:**
I'm taking taking advantage of *"Given two non-empty **strings**"* and assuming that inputs are strings. In kdb `"c"` is an atom, `(),"c"` is a string, otherwise need to add 6 bytes to the score, as we cannot use `$` to pad an atom...
[Answer]
# [C (GCC)](https://gcc.gnu.org), ~~86~~ 76 bytes
*-10 bytes thanks to [@ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)*
```
f(x,y)char*x,*y;{for(;*x|*y;putchar(0[y=*y?y:x]-46?*y:*x),x++,y++)x=*x?x:y;}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TU9RasMwDP22T6EFBo7jmBTGKAkhF9gNujIcs6yBLS1JyuR1vcdgP_npoXqbyV4yJsu8Z_np2fq-2KcXa6fpchybdH19aAQqF9ud6SUq6YpTs-9FIfGT-OE4-guRbVwpXeVy3KZ395V0ucRYYZIolyQxlhIrzF1xnj2_2m6EN9N2IoYTZ94CcLPKsq0CN-NHwIIzzt537esziMGarhHR7QAhIwVIclLGcFNCugpe7NCTeZA9jsv-JyVD5icCFygNMIgo8vzM-Py_6dobTVGD1pYQjIeamxBQh5iBm1pTQq398kU68dAeHCzYhc_VxVX_OVOj1r9P_wA)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 50 bytes
```
f=([a,...b],[c,...d])=>a+c?(c>'.'?c:a||c)+f(b,d):d
```
[Try it online!](https://tio.run/##RY9BDoIwEEX3PUV3tAEHdakpJF6jkjgdwGAqJZS48u5YKOprk/n582eaPvCFnsZumHa9q5t5bpXQmAGAqTJNi6grqQpMqRRUJJCUdML3m2TaCpPV8lTP5xtDWCY4AIXKV3DRhuEKNyuxEzVDA@FyA8v5dYIVt60LiW/Q12LEt8f@RIPdwA@2m0Ry7RMJbWenZhQX52yDvYQnDsKrwm@h/OrTXEYbVUGu9yEI1t1FK1Dvqwz1IfxcoT5WUrL5Aw "JavaScript (Node.js) – Try It Online")
]