TopcoderArchiveVisit Topcoder
SRM25 Aug 2014
SRM 635

IdentifyingWood

Problem statement, definition, constraints, and public examples.

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

  1. "absdefgh"
    "asdf"
    Returns: "Yep, it's wood."
  2. "oxoxoxox"
    "ooxxoo"
    Returns: "Nope."
  3. "oxoxoxox"
    "xxx"
    Returns: "Yep, it's wood."
  4. "qwerty"
    "qwerty"
    Returns: "Yep, it's wood."
  5. "string"
    "longstring"
    Returns: "Nope."
Back to all problems