시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 (추가 시간 없음) | 512 MB | 35 | 22 | 22 | 62.857% |
The pair removal operation is removing two adjacent characters from a string. For example, given the string "abcd
", we can obtain "ab
", "ad
", and "cd
" by pair removal.
You are given a string $t$. You can apply pair removal any number of times. Is it possible to obtain the string $s$?
The first line contains the string $s$, and the second line contains the string $t$ ($1 \le |s| \le |t| \le 10^5$). Both strings are composed of lowercase letters of English alphabet.
Print "YES
" if it is possible to obtain $s$ from $t$ using pair removal, or "NO
" otherwise.
axa abcbcxdda
YES
rrr rdfgdfgrdr
NO
w uwwu
NO
In the first test, one of the possible pair removal sequences is the following:
abcbcxdda
abcxdda
abcxa
axa