uva 10340 all in all
阿新 • • 發佈:2017-05-17
() ring ace while clu return include all urn
#include<bits/stdc++.h> using namespace std; bool cmpare(string t,string s) { int t_size=t.size(); int s_size=s.size(); int t_ipos=0,s_ipos=0; while(t_ipos<t_size&&s_ipos<s_size) { if(t[t_ipos]==s[s_ipos]) { t_ipos++; s_ipos++; } else s_ipos++; } if(s_ipos==s_size&&t_ipos!=t_size) return false; return true; } int main() { string a,b; while(cin>>a>>b) { if(cmpare(a,b)) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }
就一句話,直接模擬,往後移動下標就行。
uva 10340 all in all