Description

You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.

Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.

Input

The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace.The length of s and t will no more than 100000.

Output

For each test case output "Yes", if s is a subsequence of t,otherwise output "No".

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

Sample Output

Yes
No
Yes
No

#include<iostream>
#include<string.h>
using namespace std;
int main(long i,long j)
{
char s[100000],t[100000];
while(cin>>s>>t)
{
long lens=strlen(s);
long lent=strlen(t);
i=0;
j=0;
while(true)
{
if(i==lens)
{
cout<<"YES"<<endl;
break;
}
if(j==lent)
{
cout<<"NO"<<endl;
break;
}
if(s[i]==t[j])
{
i++;
j++;
}
else j++;
}
memset(s,'\0',lens);
memset(t,'\0',lent);
}
return 0;
}

这是一道简单题,只需比较就行了,当s串存在t串中时,输出YES;否则输出NO

最新文章

  1. c#面向对象基础技能——学习笔记(二)基于OOP思想研究对象的【属性】
  2. Ubuntu常用软件安装
  3. jQuery的Dom插入操作图示
  4. Windows Server 2008 64 位 IIS7.5 ASP.NET MVC4 发布问题
  5. C语言接口与实现实例
  6. android 学习随笔八(异常处理总结)
  7. Linux下查看文件权限、修改文件权限的方法
  8. http://www.imooc.com/video/4767 zepto教学视频笔记
  9. 读书笔记 |Google C++编程风格指南
  10. [React] Styling a React button component with Radium
  11. 扑克k,你知道的人物吗?
  12. .NET中的IO操作之文件流(一)
  13. 如何检测被锁住的Oracle存储过程及处理办法汇总(转)
  14. 基于JAVA语言的selenium测试基础总结
  15. 【NIO】Java NIO之选择器
  16. @@ITENTITY
  17. ps去掉图片上的文字
  18. Python By 360、小米
  19. 使用 mod_rewrite 来修改 Confluence 6 的 URLs
  20. spring的官方文档地址

热门文章

  1. WPF子窗体:ChildWindow
  2. apicloud教程2 (转载)
  3. Openlayers 3 的 imagelayer
  4. Android OpenGL ES(十三)通用的矩阵变换指令 .
  5. HDU 1540&lt;线段树,区间并&gt;
  6. iOS5新特性: Core Image 示例
  7. php薪资
  8. windows下python+Django+eclipse开发环境的配置
  9. POJ 1523 SPF (去掉割点能形成联通块的个数)
  10. JavaScript(四)---- 函数