title: Lexicographically Next String
signature: string lexicographicallyNextString(string s) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(string actual, string expected){
      return actual == expected;
  }
  
  string driver(string s, string expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(s), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver("amKIRzPiqLTIy", "amKIRzPiqLTIz"); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver("68", "69"); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver("100", "110"); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver("f", "g"); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver("802205375", "802206375"); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver("0111", "0211"); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver("GRjRYIvYwgua", "GRjRYIvYwgub"); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver("8139910006809", "813:910006809"); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver("100101", "200101"); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver("rw", "rx"); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }