#P7765. [COCI 2011/2012 #5] KRIŽALJKA
[COCI 2011/2012 #5] KRIŽALJKA
Description
There are two words and . Place horizontally and vertically. The overlapping part of the two words must be the same letter, and this letter must be the first occurrence in both and .
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 and .
Output Format
Output a matrix representing the placement result.
Cells without a character are represented by ..
BANANA PIDZAMA
.P....
.I....
.D....
.Z....
BANANA
.M....
.A....
MAMA TATA
.T..
MAMA
.T..
.A..
REPUBLIKA HRVATSKA
H........
REPUBLIKA
V........
A........
T........
S........
K........
A........
Hint
The testdata guarantees that a solution exists.
The strings consist of uppercase letters.
Translated from COCI 2011/2012 #5 T1。
Translated by ChatGPT 5
京公网安备 11011102002149号