You need to add string terminators '\0'
to your string before printing (or zero out the buffers memory first).
Also: you have declared buffers of size 20, but have no guards in your code to respect that allocated length, which means you could overrun them and corrupt memory. [Run with two words greater than 20 characters…]
solved Using getchar() to Read Two Strings