I am tasked with creating a program that can help users remember phone numbers by associating them with words. Before smartphones became popular, it was common to use mnemonics to remember phone numbers. One common method was to associate words with the phone numbers, as telephone keypads still show letters associated with the numbers.
To complete this task, I will be provided with a file called "ShortList.txt" that contains a list of words. My job is to extract all the three, four, and seven-letter words from this file and store them.
The program will accept user input in the form of a phone number string, which must be in the format ###-#### and only contain digits from 2 to 9 inclusive. If the input is not valid, the program will display the message "Invalid phone number" and exit.
If the input is valid, the program will then determine all the corresponding words and word combinations associated with the phone number and write them into a file called "output.txt".
Overall, this program will help users remember phone numbers more easily by associating them with familiar words and phrases.