LCC/Moose '20 Contest 1 S2 - Spellcheck

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 128M

Author:
Problem type

After the spike in unemployment in Canada post COVID-19, Nicholas can no longer afford his Premium Spell Checker™ subscription. Luckily, Nicholas has kept a word list of N words (spelled correctly) just for this occasion!

If Nicholas gives you his word list and a sentence of M words, can you make a program that helps Nicholas find his mistakes?

Input Specification

The first line contains two space separated integers N and M \left(5 \le N, M \le 10^5\right), where N represents the number of words in Nicholas' dictionary and M the number of words in his sentence.

The next line will consist of N space separated words, Nicholas' dictionary.

The next line will consist of M space separated words, Nicholas' sentence to be checked.

It is guaranteed that a word will only consist of lowercase ASCII letters and/or numbers and the length of a single word will not exceed 50 characters.

For 30\% of the points, N, M \le 1000.

Output Specification

A single line containing a space separated list of the positions of misspelled words (the first word has index 1).

Sample Input

8 9
a by is properly sentence spelled this written
this is a properly spelted sentance written by nicholas

Sample Output

5 6 9

Comments

There are no comments at the moment.