#P3333. [ZJOI2013] 丽洁体
[ZJOI2013] 丽洁体
Description
In practice and exams, we often meet questions like this: the setter gives an example sentence, and we are asked to write a similar sentence by analogy. This kind of question, often called imitation writing, appears not only in elementary school exams but sometimes also in middle school entrance exams. Many students like such questions because they feel more interesting than others. The imitated sentence often has the form “A__B__C”, where A, B, and C are given short phrases made of one or more words, and the blank parts are to be filled by the student. Of course, in exams it is also acceptable to leave the blanks empty. For example: “In fact, the sky is not dark, the dark clouds will eventually scatter; in fact , in fact , in fact the road is not long, everything will go as wished. In the days of hardship and difficulty, I pray for you. Please take care every day.” Another example: “Having seen the surging sea but not the towering mountain is a pity; having seen the towering mountain but not the , it is still a pity. Set out, always set out. , people keep an ageless mood.”
Because we are in the internet era, we can imitate not only the setter’s prompts but also all kinds of sentences and paragraphs online. On March 26, 2011, someone posted a message on a blog that drew lots of imitations.
So sad... I totally bombed the test...
...... Actually, there isn't much to say... It's all just excuses from a newbie (ju ruo, 蒟蒻)...
... As expected, I'm still only half-baked...
... I wish everyone can make the provincial team (sheng dui)... Actually, as long as there is no regret, it's fine...
Although I regret that maybe I can't keep going...
886 (bye-bye-bye)
Imitations that spread widely online are often named “X-style” (“XX ti”) because they have something unique in certain places. Open Renren, refresh Weibo, and you can find this and that style, for example, “Sorry style,” “It shows he loves you style,” and so on. Mr. Jin noticed this phenomenon and thought it would be a valuable research topic, so he began to study it and planned to publish a paper. Because posting messages online gives people more flexibility, sometimes for expression needs people also add some modifiers into the originally fixed , , . This makes it harder to decide whether a sentence or paragraph is an imitation of another sentence or paragraph.
Mr. Jin now studies works of the form “”, where , , are short phrases consisting of several words, and “*” stands for 0 or more words. He collected many such works online, but many do not strictly follow the original author’s format, which is equivalent to inserting 0 or more words into a standard work.
Because the data volume is too large, Mr. Jin cannot check them one by one. He asks you to remove as few words as possible to make it match the specified style.
Input Format
Four lines.
The first line is a possibly non-standard work .
The next three lines are , , and , respectively.
Output Format
A single line containing one integer: the minimum number of words to remove.
xiang yao yi zhi ai zhe mou wu de hua yi yao guai zhi si lai shuo tai chang le xiang yao shi xian yi qie meng xiang de hua yi ren lei zhi sheng lai shuo tai duan le
yao
tai chang le yao
tai duan le
2
Hint
Sample Explanation:
In the sample above, the non-standard work is: “If you want to keep loving something forever, then, speaking of a demon’s death, it is too long; if you want to realize all dreams, then, speaking of a human’s life, it is too short.”
A standard work has the form: “yaotoo long yaotoo short” (“要太长了要太短了”).
After modification, a valid standard work is: “If you want to keep loving something forever, then, speaking of a demon’s death, it is too long; if you want to realize all dreams, then, speaking of a human’s life, it is too short.”
Constraints:
- For 20% of the testdata, .
- For 40% of the testdata, .
- For 70% of the testdata, .
- For 100% of the testdata, ; all words have length at most , and each distinct word appears at most times; the testdata guarantees that an answer always exists.
Translated by ChatGPT 5
京公网安备 11011102002149号