P7765 [COCI 2011/2012 #5] KRIŽALJKA
Description
There are two words $A$ and $B$. Place $A$ horizontally and $B$ vertically. The overlapping part of the two words must be the **same letter**, and this letter must be the first occurrence in both $A$ and $B$.
For example, when `A="ABBA",B="CCBB"`, the output is as follows:
```
.C..
.C..
ABBA
.B..
```
Input Format
One line containing two strings made up of uppercase letters, representing $A$ and $B$.
Output Format
Output a matrix representing the placement result.
Cells without a character are represented by `.`.
Explanation/Hint
The testdata guarantees that a solution exists.
The strings consist of uppercase letters.
Translated from [COCI 2011/2012 #5 T1](https://hsin.hr/coci/archive/2011_2012/contest5_tasks.pdf)。
Translated by ChatGPT 5