1 2 3 4 5 6 7 8 9 10 11 12 13 | Input: A string of "a", "b" and "c". Output: Return true if exactly one letter is differnet from adjacent letters. Otherwise, return false. For example, in string "babbcc", first a, and first b are different from neighbours. Thus return false. Constraint: 1 <= Inout length <= 7 Example: Input: aabcc Output: true Input: abbcc Output: true Input: babbcc Output: false |
Direct link: https://paste.plurk.com/show/s9P23I9vBMa8snRWC3vi