P26649 [AtCoder] String Problem
提高+
题目描述

Problem Description

Given two strings $ S $ and $ T $, determine whether $ S $ can be transformed into $ T $ by performing the following operations any number of times in any order:

  • Operation $ A $: Remove one character A from $ S $.
  • Operation $ B $: Insert one character B at any position in $ S $.

Input Format

The input is given from the standard input in the following format:

$ S $ $ T $

Output Format

Output YES if it is possible, otherwise output NO.

Sample Input and Output

Sample Input #1

XMAS
XBMS

Sample Output #1

YES

Sample Input #2

AABABA
BABBABAB

Sample Output #2

YES

Sample Input #3

AB
AA

Sample Output #3

NO

Sample Input #4

ATCODER
CONTEST

Sample Output #4

NO

Notes/Hints

Constraints

  • $1 \leq |S|, |T| \leq 1000$
  • $ S $ and $ T $ consist only of uppercase alphabets.

Partial Points

  • If you correctly solve the dataset satisfying $|S| \leq 10$, you will be awarded 50 points.
  • If you correctly solve the dataset without additional constraints, you will be awarded an additional 50 points.

Sample Explanation 1

For example, you can perform operations as follows: XMAS → XBMAS → XBMS.

Sample Explanation 2

For example, you can perform operations as follows: AABABA → ABABA → BABABA → BABABAB → BABBABAB.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
XMAS XBMS
样例输出
YES