分类:简单字符串
题目链接:Uva10340-All in All
水题,按要求做即可
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
const int maxn=100000+100;
char s[maxn],t[maxn];
int main()
{
while(scanf("%s %s",s,t)!=EOF)
{
int tot=0;
for(int i=0;i<strlen(t);i++)
{
if(t[i]==s[tot])
{
tot++;
}
}
if(tot==strlen(s))
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
}
本文介绍了一个简单的字符串匹配问题Uva10340-AllinAll的解决方案,使用C++实现,通过逐字符比较来判断一个字符串是否为另一个字符串的子串。

被折叠的 条评论
为什么被折叠?



