All problems

Problem 835

Long Pressed Name

Easy · 10 pts · String, Two Pointers

Problem

A friend types their NAME on a keyboard, but sometimes a key gets long pressed and its letter is typed one or more extra times. Given what was TYPED, decide whether it could have come from typing NAME with some long presses. Use two pointers: a typed character must match the next name character, or else repeat the previous typed character; anything else means NO, and all of NAME must be used.

Input

The first line contains NAME. The second line contains TYPED. Both use lowercase letters.

Output

Print YES if TYPED could be a long-pressed version of NAME, otherwise NO.

Constraints

1 <= |NAME|, |TYPED| <= 1000

Example input

alex
aaleex

Example output

YES

Explanation

alex typed as aaleex: the a and the e were held down, but every letter of alex appears in order, so the answer is YES.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Find the Difference Next: Buddy Strings