#C3991. Subsequence Checker

    ID: 47479 Type: Default 1000ms 256MiB

Subsequence Checker

Subsequence Checker

Given two strings s1 and s2, determine whether s2 is a subsequence of s1.

A string s2 is a subsequence of s1 if there exists a sequence of indices $$1 \le i_1 < i_2 < \cdots < i_k \le n$$ such that $$s_{2}[j] = s_{1}[i_j]$$ for all (1 \le j \le k). In other words, all characters of s2 appear in s1 in the same order, though not necessarily contiguously.

Your task is to implement a function that reads two strings from standard input and prints "True" if the second string is a subsequence of the first, or "False" otherwise.

inputFormat

The input consists of two lines read from standard input:

  1. The first line contains the string s1.
  2. The second line contains the string s2.

Note: s2 can be an empty string.

outputFormat

Output a single line to standard output containing either "True" if s2 is a subsequence of s1, or "False" otherwise.## sample

abcde
ace
True