#K15176. Subsequence Construction

    ID: 24299 Type: Default 1000ms 256MiB

Subsequence Construction

Subsequence Construction

You are given two strings S and T. Your task is to determine whether string S can be constructed from string T by removing some characters (possibly none) from T without changing the order of the remaining characters.

In other words, S is a subsequence of T if there exists a sequence of indices \(1 \leq i_1 < i_2 < \cdots < i_k \leq |T|\) such that \(S = T_{i_1} T_{i_2} \cdots T_{i_k}\). Your program should output True if this is possible and False otherwise.

The input will be provided via standard input (stdin) with each string on a separate line, and you should output your answer to standard output (stdout).

inputFormat

The input consists of two lines:

  • The first line contains the string S.
  • The second line contains the string T.

outputFormat

Output a single line: True if S is a subsequence of T, and False otherwise.

## sample
abc
abc
True