Description

Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.

Examples

Input:s = "abc", t = "ahbgdc"
Output:true
Explanation:

'abc' is a subsequence of 'ahbgdc'.

Input:s = "axc", t = "ahbgdc"
Output:false
Explanation:

'axc' is not a subsequence of 'ahbgdc'.

Input:s = "", t = "ahbgdc"
Output:true
Explanation:

An empty string is a subsequence of any string.

Constraints

  • 0 ≤ s.length ≤ 100
  • 0 ≤ t.length ≤ 10⁴
  • s and t consist only of lowercase English letters.

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!