Under construction

Still being built. Things may change

Subsequence

Interview

Time limit1sMemory limit128 MB

Summary
For each line of input, decide whether the first string is a subsequence of the second, printing Yes or No.
Level

Easy3 of 10

Topics
Two pointers, String, Greedy, Implementation
Solved
No attempts yet

Problem

You are given two strings ss and tt. Write a program that decides whether ss is a subsequence of tt. Here, ss is a subsequence of tt if you can delete some characters of tt and concatenate the remaining characters, without reordering them, to obtain ss. In other words, every character of ss appears in tt in the same relative order (they need not be contiguous).

Input

The input consists of several test cases. Each test case is a single line containing two strings ss and tt separated by a single space. Each string has length at most 100,000. The input continues until end of file (EOF).

Output

For each test case, print Yes on its own line if ss is a subsequence of tt, and No otherwise.

Examples1

  1. Example 1

    Input
    sequence subsequence
    person compression
    VERDI vivaVittorioEmanueleReDiItalia
    caseDoesMatter CaseDoesMatter
    
    Expected output
    Yes
    No
    Yes
    No