9/2/25, 10:26 AM Problem - 2094D - Codeforces
|
stdfloat | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN
PROBLEMS SUBMIT STATUS STANDINGS CUSTOM TEST
Codeforces Round 1017 (Div. 4)
D. Tung Tung Sahur Finished
time limit per test: 2 seconds Practice
memory limit per test: 256 megabytes
You have two drums in front of you: a left drum and a right drum. A hit on the left can be recorded as "L", and a hit
on the right as "R".
→ Virtual participation
The strange forces that rule this world are fickle: sometimes, a blow sounds once, and sometimes it sounds twice.
Virtual contest is a way to take part in past contest,
Therefore, a hit on the left drum could have sounded as either "L" or "LL", and a hit on the right drum could have as close as possible to participation on time. It is
supported only ICPC mode for virtual contests. If
sounded as either "R" or "RR". you've seen these problems, a virtual contest is not
for you - solve these problems in the archive. If you
The sequence of hits made is recorded in the string p , and the sounds heard are in the string s. Given p and s, just want to solve some problem from a contest, a
virtual contest is not for you - solve this problem in
determine whether it is true that the string s could have been the result of the hits from the string p . the archive. Never use someone else's code, read
the tutorials or communicate with other person
during a virtual contest.
For example, if p ="LR", then the result of the hits could be any of the strings "LR", "LRR", "LLR", and "LLRR", but
the strings "LLLR" or "LRL" cannot. Start virtual contest
Input
The first line contains an integer t (1 ≤ t ≤ 10
4
) – the number of independent test cases. → Clone Contest to Mashup
) consisting only of the characters "R" and
5
The first line of each test case contains the string p (1 ≤ |p| ≤ 2 ⋅ 10
"L", where |p| denotes the length of the string p . → Submit?
The second line of each test case contains the string s (1 ≤ |p| ≤ |s| ≤ 2 ⋅ 10
5
) consisting only of the characters Language: GNU G++20 13.2 (64 bit, winlibs)
"R" and "L".
Choose
Choose File No file chosen
5
file:
It is guaranteed that the sum of |s| does not exceed 2 ⋅ 10 across all test cases.
Submit
Output
For each set of input data, output "YES" if s can be the heard sound, and "NO" otherwise. You may output in any
case. → Contest materials
Example
Announcement (en)
input Copy
Tutorial #1 (en)
5
R Video Tutorial (en)
RR
LRLR
LRLR
LR → CF GetRating
LLLR
LLLLLRL *1100
LLLLRRLL
LLRLRLRRL Show All Tags
LLLRLRRLLRRRL
Contest Standings
output Copy
YES
YES
NO
NO
YES
Codeforces (c) Copyright 2010-2025 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Sep/02/2025 [Link]UTC+5 (h1).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions
Supported by
[Link] 1/1