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. [POJ] 3539 Elevator

    http://poj.org/problem?id=3539 给定一个电梯,可以上升a,b,c层和回到1层,给定楼高h,求可达层数 lyd讲的同余类BFS,方法是先把三个量压成两个,即把h%a,因为对 ...

  2. 深入Linux内核架构——进程管理和调度(上)

    如果系统只有一个处理器,那么给定时刻只有一个程序可以运行.在多处理器系统中,真正并行运行的进程数目取决于物理CPU的数目.内核和处理器建立了多任务的错觉,是通过以很短的间隔在系统运行的应用程序之间不停 ...

  3. vue 单独页面定时器 离开页面销毁定时器

    data: { return { timer: null } }, created() { this.timer = setInterval(....); }, beforeDestroy() { i ...

  4. MySQL autocommit 和 start transaction

    autocommit 和 start transaction 都是事务相关的命令.类似MyISAM的mysql引擎就不支持. autocommit 默认是ON状态,即sql语句是自动提交的 show ...

  5. Python爬虫-Scrapy-CrawlSpider与ItemLoader

    一.CrawlSpider 根据官方文档可以了解到, 虽然对于特定的网页来说不一定是最好的选择, 但是 CrwalSpider 是爬取规整的网页时最常用的 spider, 而且有很好的可塑性. 除了继 ...

  6. 数据结构( Pyhon 语言描述 ) — — 第2章:集合概览

    集合类型 定义 个或多个其他对象的对象.集合拥有访问对象.插入对象.删除对象.确定集合大小以及遍历或访问集合的对象的操作 分类 根据组织方式进行 线性集合 线性集合按照位置排列其项,除了第一项,每一项 ...

  7. C#sql语句如何使用占位符

    背景:在程序中,写sql语句时,可能要根据变量的值不同,SQL语句产生相应的变化.比如说存在变量StuName,根据变量值的不同,检索不同姓名的学生记录,这时需用到占位符的知识. 1,{0}占位符,代 ...

  8. 软件测试人员遇到发现的bug不能重现怎么办?

    软件测试人员遇到发现的bug不能重现怎么办?   刚刚进入测试的童鞋们,想必都遇到过提出的bug,开发要求重现之后,但是在系统上已经重现不了的情况吧. 那么碰到这样的情况,不管开发还是测试都很纠结,开 ...

  9. 大数据学习——hdfs集群启动

    第一种方式: 1 格式化namecode(是对namecode进行格式化) hdfs namenode -format(或者是hadoop namenode -format) 进入 cd /root/ ...

  10. css装饰文本框input

    在web程序前端页面中,<input>恐怕是用的最多的html元素了,各个需要录入信息的场合都会用到它,一般都会用css来修饰一下使得它更好看. 原始的不加修饰的文本框像下面,有些单调,页 ...