Recently, some very old messages were discovered. Unfortunately, some of the letters are no longer legible. You are given a String statement containing one of the messages. Each illegible letter is represented with a '?' character. You know that all of the letters in the original text were lowercase ('a' - 'z'). For example, if the statement is "d??r", the original message might have been "door" or "dear", but not "ddr" (one letter is missing), "doctor" (too many letters) or "rear" (the first letter is wrong).
You are given two Strings word1 and word2, in the same format as statement. You must determine whether it's possible for word1 and word2 to both exist in the original message without overlapping. For example, the message "yellowtaxi" contains both "yell" and "tax", but not "yell" and "low". Return "both" if both words can exist without overlapping, "none" if neither word can exist, or "one" if at most one word can exist without overlapping (all quotes for clarity). See examples for further clarification.
|