#C4772. Password Subsequence Checker
Password Subsequence Checker
Password Subsequence Checker
Given two strings s1 and s2, determine whether s2 is a subsequence of s1. A subsequence is formed by deleting zero or more characters from s1 without changing the order of the remaining characters. In other words, s2 is a subsequence of s1 if there exist indices \(i_1, i_2, \ldots, i_k\) (with \(1 \le i_1 < i_2 < \cdots < i_k \le n\)) such that \(s1[i_1]s1[i_2]\cdots s1[i_k] = s2\). For example, "ace" is a subsequence of "abcde", but "aec" is not.
inputFormat
The input consists of two lines. The first line contains the string s1
, and the second line contains the string s2
.
outputFormat
Output True
if s2
is a subsequence of s1
, and False
otherwise.
abcde
ace
True