$active_open = "active"; // see header.php include "../files/user.php"; // also includes site.php include "../header.php"; include "authenticate.php"; if (! has_access()) { ?>
At this moment, you are not allowed access to the question.
Two words are called isomorphs (or more accurately, form an isomorphic pair) if they have the same length and the same pattern of repeated letters. The letters don't need to match between the words, only the positions where the repetitions occur. Isomorphs are of interest because one could be converted to the other using a simple substitution cipher.
Consider the words estate and tenant. In both cases the first letter is repeated five places later, and the third letter two places later. Letters in the other positions are not repeated. Define a repetition pattern to be an ordered list of relative positions where each letter is next repeated, with 0 indicating no repetition and a + preceding the repetitions for better readability. Thus both words have the repetition pattern
+5 0 +2 0 0 0The same rules apply even if a letter occurs more than twice, so the words cannon and kisses have the pattern
0 0 +1 +2 0 0People who like wordplay look for isomorphic pairs that form an incongruous phrase, like dysfunctional ventriloquism, but that level of semantic analysis is beyond even ProgComp entrants.
Write a program that identifies whether pairs of words are ismorphs. Input consists of the number of pairs on the first line (maximum 20), and then each pair on subsequent lines, separated by a space. Words are between 1 and 20 letters long, all lower-case, no punctuation.
For each pair, your program should list the two words and classify them as either
6 secret cowboy yummy tweet exponential amputations reflective programmer financial turnaround cutthroat communismproduces...
secret, cowboy are isomorphs with repetition pattern 0 +3 0 0 0 0 yummy, tweet are isomorphs with repetition pattern +4 0 +1 0 0 exponential, amputations are isomorphs with repetition pattern +5 0 0 0 +2 0 0 0 0 0 0 reflective, programmer are not isomorphs financial, turnaround have different lengths cutthroat, communism are isomorphs with repetition pattern 0 0 +1 +5 0 0 0 0 0
Test your program using the following input.
20 all inn doll door level kayak squeaky sunlamp gutless sheriff trapdoor flywheel mistiest monsoons throwaway hepatitis explosive magnesium wealthiest subterfuge kookaburra toothbrush sportswomen spokeswoman tightfisted hitchhikers cryptography manipulation sharpshooter marshmallows ambidextrous thunderclaps incompatible housewarming sportsmanlike environments disfranchised stepdaughters fastidiousness lasciviousness
You may submit multiple times. Only your most recent submission for each question will be marked.