Find Lexicographically Smallest String
Problem statement
Given a lowercase string s, find the lexicographically smallest lowercase string t that has the same length as s, is strictly greater than s, and has no two equal adjacent characters.
Lexicographic order uses the usual alphabet order from a through z. Return "-1" if no such string exists.
Function
findLexicographicallySmallestString(s: String) → StringExamples
Example 1
s = "abbcd"return = "abcab"The string "abcab" is greater than "abbcd", has the same length, and has no equal adjacent characters. Any smaller string greater than "abbcd" either keeps the invalid adjacent bb or cannot be completed validly.
Constraints
sconsists only of lowercase English letters fromathroughz.