TopcoderArchiveVisit Topcoder
SRM29 Jan 2015
SRM 649

DecipherabilityEasy

Problem statement, definition, constraints, and public examples.

Problem Statement

You had a non-empty string s but you lost it. Cat Snuke found the string and removed one character from the string. Later, Snuke gave you the string t. Can this be the string created from your string s?

You are given the Strings s and t. Return "Possible" (quotes for clarity) if t can be obtained from s by erasing exactly one character. Otherwise, return "Impossible". Note that the return value is case-sensitive.

Definition

Class:
DecipherabilityEasy
Method:
check
Parameters:
String, String
Returns:
String
Method signature:
String check(String s, String t)
(be sure your method is public)

Constraints

  • The number of characters in s will be between 1 and 50, inclusive.
  • Every character in s will be a lowercase letter ('a'-'z').
  • The number of characters in t will be between 1 and 50, inclusive.
  • Every character in t will be a lowercase letter ('a'-'z').

Examples

  1. "sunuke"
    "snuke"
    Returns: "Possible"
    If Cat Snuke erase the first 'u' from s, it will equal to t.
  2. "snuke"
    "skue"
    Returns: "Impossible"
    Swapping characters is not allowed.
  3. "snuke"
    "snuke"
    Returns: "Impossible"
    Erasing nothing is not allowed.
  4. "snukent"
    "snuke"
    Returns: "Impossible"
    Cat Snuke can erase exactly one character.
  5. "aaaaa"
    "aaaa"
    Returns: "Possible"
  6. "aaaaa"
    "aaa"
    Returns: "Impossible"
  7. "topcoder"
    "tpcoder"
    Returns: "Possible"
  8. "singleroundmatch"
    "singeroundmatc"
    Returns: "Impossible"
Back to all problems