#K5296. Is Subsequence

    ID: 29425 Type: Default 1000ms 256MiB

Is Subsequence

Is Subsequence

Given two strings ( s ) and ( t ), determine whether ( t ) is a subsequence of ( s ). A string ( t ) is considered a subsequence of ( s ) if it can be derived from ( s ) by deleting some (or no) characters without changing the order of the remaining characters. For example, given ( s = \texttt{abcde} ) and ( t = \texttt{ace} ), the output should be ( \texttt{True} ) because removing 'b' and 'd' from ( s ) yields ( t ). Conversely, if ( s = \texttt{abcde} ) and ( t = \texttt{aec} ), the output should be ( \texttt{False} ) since the order of characters in ( t ) does not match their order in ( s ).

inputFormat

The input consists of two lines. The first line contains the string ( s ) (the source string), and the second line contains the string ( t ) (the target string). Both strings consist of printable characters.

outputFormat

Output a single line: ( True ) if ( t ) is a subsequence of ( s ), otherwise ( False ).## sample

abcde
ace
True