All in All
Description
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
Output
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No
题意很是明确,不用说;
#include<stdio.h>
#include<string.h>
char s[],p[];
int main()
{
int i,j,lens,lenp;
while(~scanf("%s %s",s,p))
{
lens=strlen(s);
lenp=strlen(p);
i=;
j=;
while(j<lens&&i<lenp)
{
if(s[j]==p[i])
j++;
i++;
}
if(j==lens)
printf("Yes\n");
else
printf("No\n");
}
return ;
}
随机推荐
- Debian自启动知识 2015-03-31 20:23 79人阅读 评论(0) 收藏
Debian6添加了insserv用来代替update-rc.d.update-rc.d 就不多做介绍. Debian6里边要添加一个自动启动的服务需要先将启动脚本放在/etc/init.d,然后使用 ...
- iOS中__block 关键字的底层实现原理
在 <iOS面试题集锦(附答案)> 中有这样一道题目: 在block内如何修改block外部变量?(38题)答案如下: 默认情况下,在block中访问的外部变量是复制过去的,即:写操作不对 ...
- MD5 SHA-1 示例
测试代码 public class SignatureUtils { public static void main(String[] args) throws Exception { ...
- JS 模拟C# 字符串格式化操作
/*** ** 功能: 字符串格式化替换操作 ***/ String.prototype.format = function () { var args = arguments; return thi ...
- WPF中的资源简介、DynamicResource与StaticResource的区别(转)
什么叫WPF的资源(Resource)?资源是保存在可执行文件中的一种不可执行数据.在WPF的资源中,几乎可以包含图像.字符串等所有的任意CLR对象,只要对象有一个默认的构造函数和独立的属性. 也就是 ...
- Android Parcelable Trans byte[]
思路: http://stackoverflow.com/questions/10898116/make-custom-parcelable-containing-byte-array 谢谢, 这位外 ...
- linq学习笔记:将List<T> 转换为 Dictionary<T Key,T Value>
运用Linq,将List<T> 转换为 Dictionary<T Key,T Value> 即:List<T> ToDictionary<T Key,T V ...
- Convention插件的使用(会涉及content目录,jsp必须放入这个下面才能映射成功基于注解的配置)
http://blog.csdn.net/zclandzzq/article/details/7107816
- 【转】 KVC/KVO原理详解及编程指南
原文地址:http://blog.csdn.net/wzzvictory/article/details/9674431 前言: 1.本文基本不讲KVC/KVO的用法,只结合网上的资料说说对这种技术的 ...
- [转]PHP取整函数:ceil,floor,round,intval的区别详细解析
我们经常用到的PHP取整函数,主要是:ceil,floor,round,intval. 1.ceil -- 进一法取整 说明float ceil ( float value ) 返回不小于 value ...