Compression
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Zenyk has two binary strings \(s\) and \(t\).
In one operation Zenyk can
choose a substring of \(s\) of the form
100..00..001of length at least 5 and delete two zeros from this substringor choose a substring of \(s\) of the form
011..11..110of length at least 5 and delete two ones from this substring.
Help Zenyk figure out whether string \(t\) can be obtained from string \(s\)?
Input
The first line is given \(s\).
The second line is given \(t\).
Output
Output yes if it is possible to obtain string \(t\) from string \(s\), otherwise — output
no.
Constraints
\(1 \le |s|, |t| \le 10^5\), where \(|x|\) is the length of string \(x\),
\(s\) and \(t\) consist only of characters
0 and 1.
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 10001 101 | yes |
| Input (stdin) | Output (stdout) |
|---|---|
| 0110111 011101 | no |
Source: NextGen Contest 1
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 |
|---|