[Huawei OD Unified Exam B Paper | 100 points] English input method (C++ Java JavaScript Python)

topic description

The supervisor expects you to realize the word association function of the English input method.

The requirements are as follows:

  • According to the prefix of the word input by the user, associate the word that the user wants to input from the input English sentence, and output the associated word sequence in lexicographical order,
  • If you can't think of it, please output the word prefix entered by the user.

Notice:

  1. When associating English words, case-sensitive
  2. Abbreviated forms such as "don't" are judged as two words, "don" and "t"
  3. The output word sequence cannot have repeated words, and can only be English words, without punctuation marks

enter description

Input is two lines.

In the first line, enter a statement str consisting of the English word word and punctuation marks;

The next line is an English word prefix pre.

  • 0 < word.length() <= 20
  • 0 < str.length <=

Guess you like

Origin blog.csdn.net/shangyanaf/article/details/130926410