All in All
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 27537
Accepted: 11274

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

Source

Ulm Local 2002

水一个。

。。

就是推断字符串st1是不是字符串st2的字串。

#include <iostream>
using namespace std;
int main()
{
char st1[100000],st2[100000];
__int64 l1,l2,i,j;
while(cin>>st1>>st2)
{ i=0;j=0;
l1=strlen(st1);
l2=strlen(st2);
while(1)
{
if(i==l1)
{
printf("Yes\n");
break;
}
if(i<l1&&j==l2)
{
printf("No\n");
break;
}
if(st1[i]==st2[j])
{
i++;j++;
}
else
j++;
}
}
return 0;
}

POJ 1936 All in All(串)的更多相关文章

  1. OpenJudge/Poj 1936 All in All

    1.链接地址: http://poj.org/problem?id=1936 http://bailian.openjudge.cn/practice/1936 2.题目: All in All Ti ...

  2. POJ 1936 All in All(模拟)

    All in All 题目链接:http://poj.org/problem?id=1936 题目大意:判断从字符串s2中能否找到子串s1.字符串长度为10W. Sample Input sequen ...

  3. poj 1936 All in All(水题)

    题目链接:http://poj.org/problem?id=1936 思路分析:字符串子序列查找问题,设置两个指针,一个指向子序列,另一个指向待查找的序列,查找个字符串一次即可判断.算法时间复杂度O ...

  4. POJ 1936 All in All 匹配, 水题 难度:0

    题目 http://poj.org/problem?id=1936 题意 多组数据,每组数据有两个字符串A,B,求A是否是B的子串.(注意是子串,也就是不必在B中连续) 思路 设置计数器cnt为当前已 ...

  5. poj 1936 All in All

    All in All Time Limit: 1000 MS Memory Limit: 30000 KB 64-bit integer IO format: %I64d , %I64u   Java ...

  6. poj 1159 dp回文串

    题意:添加最少的字符使之成为回文串 #include<cstdio> #include<iostream> #include<algorithm> #include ...

  7. POJ 3461 Oulipo(模式串在主串中出现的次数)

    题目链接:http://poj.org/problem?id=3461 题意:给你两个字符串word和text,求出word在text中出现的次数 思路:kmp算法的简单应用,遍历一遍text字符串即 ...

  8. 简单的字符串比较题 POJ 1936

    Description You have devised a new encryption technique which encodes a message by inserting between ...

  9. POJ 3461 Oulipo(KMP,模式串在主串中出现次数 可重叠)

    题意:给你两个字符串p和s,求出p在s中出现的次数. 显然,我们要先把模式串放到前面,之后主串放后面,中间隔开,这样就可以根据前缀数组的性质来求了. 我先想直接把p接到s前面,之后求Next数组对st ...

随机推荐

  1. 最近公共祖先-三(RMQ-ST)

    描述 上上回说到,小Hi和小Ho使用了Tarjan算法来优化了他们的"最近公共祖先"网站,但是很快这样一个离线算法就出现了问题:如果只有一个人提出了询问,那么小Hi和小Ho很难决定 ...

  2. selenium Select下拉框

    先来认识一下下拉框,以百度的“高级设置”为例 介绍两种方法来处理下拉框:使用click事件,使用Select方法 使用click事件 上述下拉框的源代码如下: 虽然我们可以在html源文件中看到sel ...

  3. 二手GTX650

    某鱼入手一二手华硕显卡GTX650 店主信誉挺高的,到手图片 我K,被骗了翻新的假显卡,华硕没有过这个样式的GTX650啊,还是新的散热风扇及前挡板,不管了先把风扇拆了,竟然连风扇散热硅脂都是刚刚涂上 ...

  4. 微信小程序显示cms里的html文章

    首先在cms模版中将html文章转化为json数据,识别图片,文本和换行,过滤掉样式和标签.这里是用PHP的正则表达式函数来实现的,$content是cms里的html文章. <?php $_a ...

  5. .NET中的缓存实现

    软件开发中最常用的模式之一是缓存,这是一个简单但非常有效的概念,想法是重用操作结果,执行繁重的操作时,我们会将结果保存在缓存容器中,下次我们需要该结果时,我们将从缓存容器中取出它,而不是再次执行繁重的 ...

  6. 大数据学习——linux系统的网卡配置步骤

    ifconfig 查看ip,没有ip时需要配置 配置步骤: 1输入命令setup,选择network configuration,选择runtool,选择device configuration,选择 ...

  7. MySQL语句之or和and多条件查询

    在where中可以包含任意数目的and和or操作符,需要注意的是在没有任何其他符号的时候,例如括号,AND的优先级高于OR,因此,当两者一起使用时,先运算AND两边的条件表达式,再运算OR两边的条件表 ...

  8. step 1:begin to identify something in english(to becaome a baby again)

    long long ago , i think if i want to improve my english especially computer english . i must do so m ...

  9. waiting TTFB 时间优化

    百度百科解释:获取在接收到响应的首字节前花费的毫秒数. 根据chrome浏览器,具体请求链接的这个时间,对反应慢的页面进行优化.

  10. POJ 1509 循环同构的最小表示法

    题目大意: 给定一个字符串,可以把一段尾部接到头部,这样找到一个最小的字符串 方案一: 利用循环同构中找最小表示的方法来解决 论文参考http://wenku.baidu.com/view/438ca ...