标签:cout ring main ++ cpp str 一句话 als pos
#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;
}
}
就一句话,直接模拟,往后移动下标就行。
标签:cout ring main ++ cpp str 一句话 als pos
原文地址:http://www.cnblogs.com/masterchd/p/6866876.html