码迷,mamicode.com
首页 > 其他好文 > 详细

uva 10340 all in all

时间:2017-05-17 13:45:34      阅读:107      评论:0      收藏:0      [点我收藏+]

标签: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;
    }
}

  就一句话,直接模拟,往后移动下标就行。

uva 10340 all in all

标签:cout   ring   main   ++   cpp   str   一句话   als   pos   

原文地址:http://www.cnblogs.com/masterchd/p/6866876.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!