Check a Cyclic Next-Character String
Problem statement
You are given two equal-length lowercase strings, source and target.
Return true if every character in target is the next lowercase English letter after the character at the same position in source. The successor of z is a. Otherwise, return false.
Function
isNextCharacterString(source: String, target: String) → booleanExamples
Example 1
source = "az"target = "ba"return = truea advances to b, and z wraps to a.
Example 2
source = "abc"target = "abd"return = falseThe first position fails because the successor of a is b, not a.
Constraints
1 <= source.length == target.length <= 100000- Both strings contain only lowercase English letters.