501人阅读 评论(0)

# Combine String

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 151    Accepted Submission(s): 78

Problem Description
Given three strings a, b and c, your mission is to check whether c is the combine string of a and b.
A string c is said to be the combine string of a and b if and only if c can be broken into two subsequences, when you read them as a string, one equals to a, and the other equals to b.
For example, adebcf'' is a combine string of abc'' and def''.

Input
Input file contains several test cases (no more than 20). Process to the end of file.
Each test case contains three strings a, b and c (the length of each string is between 1 and 2000).

Output
For each test case, print Yes'', if c is a combine string of a and b, otherwise print No''.

Sample Input
abc
def
abc
def
abecdf

Sample Output
Yes
No题意：给定a，b，c三个串，问c能否按序分成a和b串，不要求连续。题目链接：Combine String解题思路：   直接模拟，1.统计处a,b,c串各个字符出现的次数，看a,b串的某个字符出现次数的和是否与c串中的相等。           2.从头往后扫描c串，看是否能按序找到a,b串。代码：
0
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：19532次
• 积分：788
• 等级：
• 排名：千里之外
• 原创：60篇
• 转载：6篇
• 译文：0篇
• 评论：10条
阅读排行
评论排行
最新评论