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.
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
"sunuke"
"snuke"
Returns: "Possible"
If Cat Snuke erase the first 'u' from s, it will equal to t."snuke"
"skue"
Returns: "Impossible"
Swapping characters is not allowed."snuke"
"snuke"
Returns: "Impossible"
Erasing nothing is not allowed."snukent"
"snuke"
Returns: "Impossible"
Cat Snuke can erase exactly one character."aaaaa"
"aaaa"
Returns: "Possible"
"aaaaa"
"aaa"
Returns: "Impossible"
"topcoder"
"tpcoder"
Returns: "Possible"
"singleroundmatch"
"singeroundmatc"
Returns: "Impossible"