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 ;
}
随机推荐
- DAG最短路算法
#include <cstdio> #include <iostream> #include <queue> #include <vector> #in ...
- Python异常处理 分类: python Raspberry Pi 服务器搭建 2015-04-01 13:22 172人阅读 评论(0) 收藏
一个程序要保持稳定运行必须要有异常处理,本文将简单介绍Python中的try-except..异常处理语句的使用. 该种异常处理语法的规则是: 执行try下的语句,如果引发异常,则执行过程会跳到第一个 ...
- [Javascript] Modifying an Immutable.js Map()
We will now look at five methods that modify an Immutable.Map(). set update delete clear merge //set ...
- /proc/sys/ 下内核参数解析
http://blog.itpub.net/15480802/viewspace-753819/ http://blog.itpub.net/15480802/viewspace-753757/ ht ...
- linux进程调度之 FIFO 和 RR 调度策略---SYSTEMTAP
http://blog.chinaunix.net/uid-24774106-id-3379478.html http://blog.chinaunix.net/uid-24774106-id-337 ...
- Android开发:最详细的 Toolbar 开发实践总结
最详细的 Toolbar 开发实践总结 过年前发了一篇介绍 Translucent System Bar 特性的文章 Translucent System Bar 的最佳实践,收到很多开发者的关注和反 ...
- [iOS开发] 使用第三方字体不生效
iOS中使用第三方字体并不复杂,通常只需要如下三个步骤: 1. 将第三方字体文件添加到工程(Project)中: 2. 在info.plist中添加一个新的键"Fonts provided ...
- php 编译安装的一个 configure 配置
yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel f ...
- SQL Server DBA工作内容详解
在Microsoft SQL Server 2008系统中,数据库管理员(Database Administration,简称为DBA)是最重要的角色.DBA的工作目标就是确保Microsoft SQ ...
- Myeclipse快捷键的设置