All in All UVA - 10340
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. Input is terminated by EOF.
Output
For each test case output, if s is a subsequence of t.
Sample Input
sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter
Sample Output
Yes
No
Yes
No
HINT
这个题用C++做的,一开始数组开小了,后来开太大了,果断选择string。代码简单,看就好不多解释。
Accepted
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main() {
string s, t;
while (cin >> s >> t)
{
int j = 0;
for (int i = 0;i < t.length(); i++)
if (s[j] == t[i])j++;
cout << (j == s.length() ? "Yes" : "No" )<< endl;
}
return 0;
}
All in All UVA - 10340的更多相关文章
- 贪心水题。UVA 11636 Hello World,LA 3602 DNA Consensus String,UVA 10970 Big Chocolate,UVA 10340 All in All,UVA 11039 Building Designing
UVA 11636 Hello World 二的幂答案就是二进制长度减1,不是二的幂答案就是是二进制长度. #include<cstdio> int main() { ; ){ ; ) r ...
- UVa 10340 - All in All 水题 难度: 0
题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...
- uva 10340 All in All
水题,从头到尾扫一遍就可以了,输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串s.例如,abcde可以得到bce,但无法得到dc. #include<a ...
- UVA 10340 (13.08.25)
Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memory Limi ...
- UVa 10340 子序列
https://vjudge.net/problem/UVA-10340 题意: 输入两个字符串s和t,判断是否可以从t中删除0个或多个字符得到字符串s. 思路: 很水的题... #include&l ...
- UVa 10340 All in All (水题,匹配)
题意:给定两个字符串,问第一个串能不能从第二个串通过删除0个或多个字符得到. 析:那就一个字符一个字符的匹配,如果匹配上了就往后走,判断最后是不是等于长度即可. 代码如下: #include < ...
- UVA 10340 All in All(字符串,朴素匹配)
#include <stdio.h> #include <algorithm> #include <cstring> using namespace std; ], ...
- 【习题 3-9 UVA - 10340】All in All
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 相当于让你判断s1是不是s2的子序列. for一遍就好 [代码] #include <bits/stdc++.h> us ...
- UVA 10340 - All in All 水~
看题传送门 Problem E All in All Input: standard input Output: standard output Time Limit: 2 seconds Memor ...
随机推荐
- cobra-强大的CLI应用程序库
cobra介绍 Cobra是一个用于创建强大的现代CLI应用程序的库,也是一个用于生成应用程序和命令文件的程序. Cobra用于许多Go项目,如Kubernetes.Hugo和Github CLI等. ...
- 痞子衡嵌入式:自识别特性(Auto Probe)可以让i.MXRT1060无需FDCB也能从NOR Flash启动
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家分享的是自识别特性(Auto Probe)可以让i.MXRT1060无需FDCB也能从NOR Flash启动. 接着上篇文章 <了解i.M ...
- 分布式流转开发常见报错FAQ
鸿蒙入门指南,小白速来!0基础学习路线分享,高效学习方法,重点答疑解惑--->[课程入口] HarmonyOS开发中分布式协同是非常重要的一个功能,大家在刚接触的时候可能会出现各种各样的错误.我 ...
- Django-1.11中文文档-模型Models(一)
官方文档链接 模型是数据信息的唯一并明确的来源.它包含了我们储存的数据的基本字段和行为.通常,每个模型映射到一张数据库表. 基本概念: 每个模型都是django.db.models.Model的一个子 ...
- 学习java之基础语法(三)
学习java之基础语法(三) java运算符 计算机的最基本用途之一就是执行数学运算,作为一门计算机语言,Java也提供了一套丰富的运算符来操纵变量.我们可以把运算符分成以下几组: 算术运算符 关系运 ...
- 【转载】java类加载时机与过程
1 开门见山 以前曾经看到过一个java的面试题,当时觉得此题很简单,可是自己把代码运行起来,可是结果并不是自己想象的那样.题目如下: class SingleTon { private stati ...
- POJ1458 Common Subsequence
题目链接:http://poj.org/problem?id=1458 分析:最大公共子序列模板 1 #include<iostream> 2 #include<sstream> ...
- ASP.NET如何把ASPX网站部署到IIS上
当一个项目完成了,你是否想过把它发布到服务器上去呢?那么下面就来告诉你如何去部署它吧! (Visual Studio版本: 2019) 首先要准备好你的项目 然后进行如下操作 第一大步骤 1.打开你需 ...
- CSDN博客转MD格式
基于大神作品修改原文,使用了一下发现有一些小问题,爬取的博客标题如果含有字符是Windows不支持的命名格式,会卡在界面,进行了一下优化,加了一些字符过滤处理,但是tomd模块对html的处理还是不是 ...
- iOS 面试秘籍全套
栏目将持续更新--请iOS的小伙伴关注! (答案不唯一,仅供参考,文章最后有福利) iOS面试题大全(上) iOS面试题大全(下) 目录: iOS面试题:Run Loop iOS面试题:性能优化 ...