358B.md (2233B)
1 Source: https://codeforces.com/problemset/problem/358/B 2 3 B. Dima and Text Messages 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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. 22 23 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. 24 25 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. 26 27 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. 28 29 Input 30 31 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. 32 33 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. 34 35 Output 36 37 In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise. 38 39 Examples 40 41 Input 42 43 ``` 44 3 45 i 46 love 47 you 48 <3i<3love<23you<3 49 ``` 50 51 Output 52 53 ``` 54 yes 55 ``` 56 57 Input 58 59 ``` 60 7 61 i 62 am 63 not 64 main 65 in 66 the 67 family 68 <3i<>3am<3the<3<main<3in<3the<3><3family<3 69 ``` 70 71 Output 72 73 ``` 74 no 75 ``` 76 77 Note 78 79 Please note that Dima got a good old kick in the pants for the second sample from the statement.