Zenyk and the string
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Zenyk, like most of his classmates, wants to get good scores on the EIE (External Independent Evaluation). He needs this very much because he wants to enter university and become a programmer. Right now he is learning to program and trying to solve one very interesting problem.
You are given a string \(s\)
consisting only of the characters A, B, C, D. For each
character, you need to keep either all its odd occurrences or all its
even occurrences. In other words, you need to keep every second
occurrence of the letter starting from the first, or every second
occurrence starting from the second.
Determine whether it is possible to form the string \(t\) from the string \(s\).
Input
The first line gives \(s\).
The second line gives \(t\).
Output
In a single line, output Yes if it is possible to form
the string \(t\) from the string \(s\), and No otherwise.
Constraints
\(1 \le |s|, |t| \le 10^{5}\),
both strings contain only the letters A, B, C, D.
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| AAABBBA AAB | Yes |
| Input (stdin) | Output (stdout) |
|---|---|
| AAABBBA ABA | Yes |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|