insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Check if one string is a subsequence (not necessarily contiguous) of another.

Check if one string is a subsequence (not necessarily contiguous) of another.

Difficulty: Hard

Phase: 6 · Mixed Logical Challenges

XP Reward: 30 XP

Topics: Mixed Logical Challenges, Hard

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given two strings S1 and S2 on separate lines, check if S1 is a subsequence of S2. Print 'Yes' or 'No'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: abc ahbgdc

Output: Yes

Explanation: Sample execution for input abc ahbgdc