Algorithms
Medium
2825
3018
Make String a Subsequence Using Cyclic Increments
make-string-a-subsequence-using-cyclic-increments
"""
You are given two 0-indexed strings str1 and str2.

In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is 'a' becomes 'b', 'b' becomes 'c', and so on, and 'z' becomes 'a'.

Return true if it is possible to make str2 a subsequence of str1 by performing the operation at most once, and false otherwise.

Note: A subsequence of a string is a new string that is formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.

Example 1:

Input: str1 = "abc", str2 = "ad"
Output: true
Explanation: Select index 2 in str1.
Increment str1[2] to become 'd'.
Hence, str1 becomes "abd" and str2 is now a subsequence. Therefore, true is returned.

Example 2:

Input: str1 = "zc", str2 = "ad"
Output: true
Explanation: Select indices 0 and 1 in str1.
Increment str1[0] to become 'a'.
Increment str1[1] to become 'd'.
Hence, str1 becomes "ad" and str2 is now a subsequence. Therefore, true is returned.

Example 3:

Input: str1 = "ab", str2 = "d"
Output: false
Explanation: In this example, it can be shown that it is impossible to make str2 a subsequence of str1 using the operation at most once.
Therefore, false is returned.

Constraints:

 * 1 <= str1.length <= 105
 * 1 <= str2.length <= 105
 * str1 and str2 consist of only lowercase English letters.
"""
class Solution:
    def canMakeSubsequence(self, str1: str, str2: str) -> bool:
        
You are given two 0-indexed strings str1 and str2.

In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is 'a' becomes 'b', 'b' becomes 'c', and so on, and 'z' becomes 'a'.

Return true if it is possible to make str2 a subsequence of str1 by performing the operation at most once, and false otherwise.

Note: A subsequence of a string is a new string that is formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.

Example 1:

Input: str1 = "abc", str2 = "ad"
Output: true
Explanation: Select index 2 in str1.
Increment str1[2] to become 'd'.
Hence, str1 becomes "abd" and str2 is now a subsequence. Therefore, true is returned.

Example 2:

Input: str1 = "zc", str2 = "ad"
Output: true
Explanation: Select indices 0 and 1 in str1.
Increment str1[0] to become 'a'.
Increment str1[1] to become 'd'.
Hence, str1 becomes "ad" and str2 is now a subsequence. Therefore, true is returned.

Example 3:

Input: str1 = "ab", str2 = "d"
Output: false
Explanation: In this example, it can be shown that it is impossible to make str2 a subsequence of str1 using the operation at most once.
Therefore, false is returned.

Constraints:

 * 1 <= str1.length <= 105
 * 1 <= str2.length <= 105
 * str1 and str2 consist of only lowercase English letters.


Please complete the code below to solve above prblem:
```python
class Solution:
    def canMakeSubsequence(self, str1: str, str2: str) -> bool:
        
```

my_solution = Solution()

test_input = { "str1": "ab", "str2": "d" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "a", "str2": "d" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "abc", "str2": "ad" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "b", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "c", "str2": "b" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "c", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "zc", "str2": "ad" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "b", "str2": "c" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "c", "str2": "m" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "d", "str2": "h" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "f", "str2": "f" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "f", "str2": "g" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "d", "str2": "m" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "g", "str2": "g" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "h", "str2": "i" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "d", "str2": "x" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "i", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "j", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "j", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "f", "str2": "s" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "i", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "k", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "l", "str2": "d" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "k", "str2": "l" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "m", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "l", "str2": "l" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "m", "str2": "n" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "o", "str2": "p" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "o", "str2": "c" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "o", "str2": "n" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "p", "str2": "a" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "p", "str2": "s" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "q", "str2": "q" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "q", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "s", "str2": "f" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "s", "str2": "u" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "r", "str2": "s" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "t", "str2": "h" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "t", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "t", "str2": "u" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "u", "str2": "w" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "u", "str2": "u" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "w", "str2": "y" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "u", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "at", "str2": "se" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "cl", "str2": "qs" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "v", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "w", "str2": "w" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "cq", "str2": "xz" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "y", "str2": "y" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ct", "str2": "xb" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "z", "str2": "a" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "fs", "str2": "rd" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "z", "str2": "z" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "gq", "str2": "kn" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "hq", "str2": "dk" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "dm", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "eh", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ir", "str2": "ka" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "is", "str2": "af" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ja", "str2": "zz" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "jq", "str2": "zi" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ke", "str2": "qw" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "fp", "str2": "p" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "hz", "str2": "z" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ia", "str2": "a" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "lo", "str2": "fa" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "km", "str2": "l" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "mu", "str2": "za" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "np", "str2": "q" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "nh", "str2": "pa" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "oj", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "oh", "str2": "hu" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "pg", "str2": "xb" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "uq", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "pl", "str2": "yi" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ww", "str2": "x" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "xh", "str2": "x" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "yg", "str2": "y" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "px", "str2": "dh" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "rm", "str2": "au" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "se", "str2": "vs" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "yw", "str2": "w" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "st", "str2": "zf" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "dby", "str2": "z" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "sx", "str2": "fx" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ei", "str2": "ei" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ff", "str2": "fg" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "to", "str2": "yv" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "tv", "str2": "ei" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "va", "str2": "ow" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "jc", "str2": "jd" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "jrg", "str2": "h" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "lf", "str2": "lg" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "agb", "str2": "vgz" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "amk", "str2": "nto" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "atd", "str2": "xrr" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "pc", "str2": "qc" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ayt", "str2": "nov" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "qv", "str2": "rv" }
assert my_solution.canMakeSubsequence(**test_input) == True