首页 > 代码库 > uva 10340 all in all
uva 10340 all in all
#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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。