Problem Statement
We call a pair of Strings (s, t) "wood" if t is contained in s as a subsequence. (See Notes for a formal definition.)
Given Strings s and t, return the String "Yep, it's wood." (quotes for clarity) if the pair (s, t) is wood and "Nope." otherwise.
Definition
- Class:
- IdentifyingWood
- Method:
- check
- Parameters:
- String, String
- Returns:
- String
- Method signature:
- String check(String s, String t)
- (be sure your method is public)
Notes
- String t is contained in string s as a subsequence if we can obtain t by removing zero or more (not necessarily consecutive) characters from s.
Constraints
- s and t will consist only of lowercase English letters.
- s and t will each be between 1 and 10 characters long, inclusive.
Examples
"absdefgh"
"asdf"
Returns: "Yep, it's wood."
"oxoxoxox"
"ooxxoo"
Returns: "Nope."
"oxoxoxox"
"xxx"
Returns: "Yep, it's wood."
"qwerty"
"qwerty"
Returns: "Yep, it's wood."
"string"
"longstring"
Returns: "Nope."