프로그램 명: hsin_gta
제한시간: 5 초

Dubravka the chemist examines DNA molecules in her laboratory. Each DNA molecule is represented with a series of characters, where each characters is from the set {‘A’, ‘C’, ‘G’, ‘T’}. Therefore, ‘A’, ‘ATG’ and ‘GTA’ are series of characters which represent different DNA molecules.

Dubravka can perform the following mutations (alterations) in any part of the DNA molecule:

Dubravka tends to take a certain molecule and alter it by successively applying these mutations. This results in a different molecule, for example:
AA → TCA → TAGA → TAT.
Dubravka currently has N molecules in her laboratory. Write a programme that will, for each pair of given molecules, determine whether it is possible to end up with the second molecule when starting from the first molecule by applying the mentioned mutations.

입력

출력

Output exactly N characters in each of N lines. The j-th character in the i-th line should be ‘1’ if it’s possible to get molecule j from the molecule i, otherwise it should be ‘0’. You mustn’t print spaces between individual characters in the same line.

입출력 예

입력

4
A
C
G
T

출력

1000
0100
0010
0001
입력

4
AA
TAT
C
CGTAC

출력

1100
1100
0011
0011

입력

4
AAA
CCC
TATA
CACA

출력

1111
1111
1111
1111
출처:CROATIAN HIGH SCHOOL COMPETITION

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]