title: Lexicographically Next String
signature: func lexicographicallyNextString(s string) string {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual string, expected string) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(s string, expected string) string {
      if validateSolution(PLACEHOLDER_FN_NAME(s),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver("amKIRzPiqLTIy", "amKIRzPiqLTIz")
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("68", "69")
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("100", "110")
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("f", "g")
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver("802205375", "802206375")
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver("0111", "0211")
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver("GRjRYIvYwgua", "GRjRYIvYwgub")
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver("8139910006809", "813:910006809")
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver("100101", "200101")
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver("rw", "rx")
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def lexicographically_next_string(s):
      if (s == ' '):
          return 'a'
      i = (len(s) - 1)
      while ((s[i] == 'z') and (i >= 0)):
          i -= 1
      if (i == (- 1)):
          s = (s + 'a')
      else:
          s = s.replace(s[i], chr((ord(s[i]) + 1)), 1)
      return s
source_cpp: string lexicographically_next_string(string s) {
    if ( s == "" ) return "a";
    int i = s . length ( ) - 1;
    while ( s [ i ] == 'z' && i >= 0 ) i --;
    if ( i == - 1 ) s = s + 'a';
    else s [ i ] ++;
    return s;
  }