Codeforces Round #208 (Div. 2) B Dima and Text Messages

OpenSoucre發表於2013-10-28
 1 #include <iostream>
 2 #include <algorithm>
 3 #include <string>
 4 
 5 using namespace std;
 6 
 7 int main(){
 8     int n;
 9     cin >> n;
10     string words = "<3",tmp;
11     for(int i = 0 ; i < n ; ++ i){
12         cin >> tmp;
13         words +=tmp+"<3";
14     }
15     string message;
16     cin >> message;
17     if(message.length() < words.length()) cout<<"no"<<endl;
18     else{
19         int k = 0;
20         for(int i = 0 ; i < words.length();){
21             while(k< message.length() && message[k]!=words[i]) k++;
22             if(k >= message.length()){cout<<"no"<<endl; return 0;}
23             else ++i;
24         }
25         cout<<"yes"<<endl;
26     }
27 }

 

相關文章