#C6279. Subsequence Verification

    ID: 50021 Type: Default 1000ms 256MiB

Subsequence Verification

Subsequence Verification

Given two strings s and p, determine whether p is a subsequence of s. A string p is a subsequence of string s if all characters of p can be found in s in the same order (not necessarily contiguous). Formally, if s has length \(n\) and p has length \(m\), then p is a subsequence of s if there exists indices \(1 \le i_1 < i_2 < \cdots < i_m \le n\) such that \(s[i_j] = p[j]\) for all \(1 \le j \le m\).

Output True if p is a subsequence of s, otherwise output False.

inputFormat

The input consists of two lines:

  • The first line contains the source string s.
  • The second line contains the pattern string p.

outputFormat

Output a single line: either True if p is a subsequence of s, or False otherwise.

## sample
codereview
crew
True