A cryptogram is a type of puzzle that consists of a short piece of encrypted text. Though once used in more serious applications, they are now mainly printed for entertainment in newspapers and magazines. Generally the cipher used is simple enough that the cryptogram can be solved by hand. In its simplest form, a substitution cipher is used that encrypts the text by replacing each letter in the alphabet with a different letter. An uppercase letter and its corresponding lowercase counterpart are thereby always mapped onto the same letter, where the use of uppercase and lowercase is maintained. Characters that represent no letters of the alphabet remain unchanged in the ciphertext. To solve the puzzle, one must figure out the mapping of the letters using in the coding scheme, such that the original lettering can be recovered.
Write a function cryptogram that takes two string arguments that have an equal length. The first string represents the encrypted text given as the cryptogram puzzle. The second string represents a partial solution of the cryptogram. In that solution, some of the letter occurrences have already been replaced by their corresponding letter used in the mapping scheme. Letters that have not been replaced yet in the partial solution, are indicated by a question mark (?). The function must return a string that replaces as many characters as possible in the partial solution by their corresponding letter (while maintaining the use of uppercase and lowercase letters), based on the letters that have already been replaced.
>>> puzzle = 'Qmvrbwlf xwkd iopzlw vf zml pcwvfxzvyl.'
>>> solution = 'Ch?ld??? ??ow fas??r ?n ??? ?p?i?gt?me.'
>>> cryptogram(puzzle, solution)
'Children grow faster in the springtime.'
>>> puzzle = 'Zhp suxobpuw sbmtkopw Nxwkdnx.'
>>> solution = '?h? p?n???a? ?rod?ces I???l??.'
>>> cryptogram(puzzle, solution)
'?he pancreas prod?ces Ins?lin.'
>>> puzzle = 'Jujso ldmtq wyjqi tvadi ltek tq lads tw t wcqnej xjee.'
>>> solution = '?v?ry ??ma? ?p??? ?bout h??f ?? ???? ?s ? ??ng?e c?l?.'
>>> cryptogram(puzzle, solution)
'Every human spent about half an hour as a s?ngle cell.'
>>> puzzle = "V atult'a amrdd qvl zr nrbrqbrn zx v wumvl v medr vivx."
>>> solution = "? ????k's ???l? ??n ?? ??t???ed ?y a hum?? ? ?i?? ?w??."
>>> cryptogram(puzzle, solution)
"A skunk's smell ?an ?e dete?ted ?y a human a mile away."