poj1936

简单题

View Code
   
     
#include < iostream >
#include
< cstdio >
#include
< cstdlib >
#include
< cstring >
using namespace std;

#define maxn 100005

char a[maxn], b[maxn];

int main()
{
// freopen("t.txt", "r", stdin);
int lena, lenb;
while (scanf( " %s%s " , a, b) != EOF)
{
lena
= strlen(a);
lenb
= strlen(b);
bool ok = true ;
int j = 0 ;
for ( int i = 0 ; i < lena; i ++ )
{
while (b[j] != a[i] && j < lenb)
j
++ ;
if (j == lenb)
{
ok
= false ;
break ;
}
j
++ ;
}
if (ok)
printf(
" Yes\n " );
else
printf(
" No\n " );
}
return 0 ;
}

你可能感兴趣的:(poj)