E. 慕雪少年的字符串压缩挑战

    传统题 1000ms 256MiB

慕雪少年的字符串压缩挑战

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Background

Muxue the youth has invented an efficient string compression algorithm. He wants to test the practicality of this algorithm.

Problem Description

Muxue has invented a string compression algorithm: for a string s, if it has k consecutive identical characters c, it can be compressed to kc (if k=1, then k is omitted).

For example: "aaabbb" compresses to "3a3b", "abc" compresses to "abc".

Now Muxue has two strings A and B. He wants to know whether the compressed representation of A is a subsequence of B (not necessarily contiguous).

Note: A subsequence is a sequence formed by deleting some characters (possibly none) from the original sequence while maintaining the relative order of the remaining characters.

Input Format

First line: string A (1 ≤ |A| ≤ 1000)
Second line: string B (1 ≤ |B| ≤ 1000)
The strings contain only lowercase letters.

Output Format

If the compressed representation of A is a subsequence of B, output "YES"; otherwise output "NO".

Sample Input and Output #1

Input #1

aaabbb
a3b

Output #1

YES

Explanation/Notes

Explanation for Sample 1: A="aaabbb" compresses to "3a3b", B="a3b" contains the subsequence "3a3b" (delete the first 'a').

This problem uses Subtask bundled testing

【XJS-C5-Div4】XJSOI 春节大月赛 Round 3 & 勰码可达鸭合作赛 Round 1

未参加
状态
已结束
规则
IOI
题目
5
开始于
2026-2-7 0:00
结束于
2026-2-14 0:00
持续时间
3 小时
主持人
参赛人数
7