The magazine Amazing Coding runs a puzzle contest in every issue and gives away the latest digital gadgets as prizes. Its readers are programmers, so the magazine asks them to solve the puzzles by writing programs.
The puzzle in the latest issue is about deciding some of the letters of a string, called the secret string below, from a collection of hints. The figure shows one example of the hints.

The first hint is the length of the secret string. In the figure it is nine, and the nine boxes correspond to nine letters. Letter positions, that is box numbers, are counted from 1, from the left to the right.
Hints of the second kind give the letter of the secret string at a specific position. In the figure, the letters in boxes 3, 4, 7, and 9 are C, I, C, and P.
Hints of the third kind are about repeated substrings of the secret string. The bar immediately below the boxes is cut into sections, each covering a substring of the secret string. A section may be joined by a line running to the left with another section of the same length. The substrings covered by two joined sections are equal. One hint in the figure says that the letters in boxes 8 and 9 equal the letters in boxes 4 and 5, and from that you get the substring IP.
Not every pair of equal substrings of the secret string appears among the hints. Some pairs are left out.
Two joined sections may also overlap. In the figure, the two letter substring in boxes 2 and 3 is said to equal the one in boxes 1 and 2, and the two sections share box 2.
In this example every position of the secret string can be decided, and the string is CCCIPCCIP. In general the hints may not be enough to decide every letter.
The answer to the puzzle is the letters at the asked positions. Write a question mark ? when the letter at an asked position cannot be decided from the given hints.