CF358B.Dima and Text Messages

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.

Dima and Inna are using a secret code in their text messages. When Dima wants to send Inna some sentence, he writes out all words, inserting a heart before each word and after the last word. A heart is a sequence of two characters: the "less" characters (<) and the digit three (3). After applying the code, a test message looks like that: <3_word_1<3_word_2<3 ... word__n<3.

Encoding doesn't end here. Then Dima inserts a random number of small English characters, digits, signs "more" and "less" into any places of the message.

Inna knows Dima perfectly well, so she knows what phrase Dima is going to send her beforehand. Inna has just got a text message. Help her find out if Dima encoded the message correctly. In other words, find out if a text message could have been received by encoding in the manner that is described above.

谢尔盖的性格非常善变。这次他拒绝让迪马和他的女友(顺便提一下,她叫因娜)进入房间。然而,这对恋人总能找到沟通的方法。今天,他们正通过短信交流。

迪马和因娜在短信中使用一种秘密编码。当迪马想向因娜发送某个句子时,他会将所有单词依次写出,并在每个单词前插入一个“心形符号”,且在最后一个单词后也插入一个“心形符号”。所谓“心形符号”,是由两个字符组成的序列:“小于号”(<)和数字三(3)。经过该编码后,测试消息形如:<3_word_1<3_word_2<3 ... word__n<3。

编码过程并未到此结束。随后,迪马会在消息的任意位置插入任意数量的小写英文字母、数字以及“大于号”(>)和“小于号”(<)。

因娜对迪马非常了解,因此她事先就知道迪马打算发给她的原句是什么。因娜刚刚收到了一条短信。请帮她判断:迪马是否正确地对该消息进行了编码?换言之,请判断该短信是否可能通过上述描述的方式编码得到。

输入格式

The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105.

The last line contains non-empty text message that Inna has got. The number of characters in the text message doesn't exceed 105. A text message can contain only small English letters, digits and signs more and less.

第一行包含一个整数 nn(1≤n≤1051 \leq n \leq 10^5)——表示迪马消息中的单词数量。接下来的 nn 行每行包含一个非空单词。这些单词仅由小写英文字母组成。所有单词的总长度不超过 10510^5。

最后一行包含茵娜收到的非空文本消息。该文本消息的字符数不超过 10510^5。文本消息中仅可包含小写英文字母、数字以及加号(+)和减号(-)。

输出格式

In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.

在一行中,如果迪马正确解码了文本消息,则输出 "yes"(不带引号),否则输出 "no"(不带引号)。

输入输出样例

  • 输入#1

    3
    i
    love
    you
    &lt;3i&lt;3love&lt;23you&lt;3

    输出#1

    yes
  • 输入#2

    7
    i
    am
    not
    main
    in
    the
    family
    &lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3

    输出#2

    no

说明/提示

Please note that Dima got a good old kick in the pants for the second sample from the statement.

请注意,根据题面描述,迪马在第二个样例中被狠狠地踢了一脚。

输入解题思路,AI测评打分。不知道怎么写?

首页