title: Lexicographical Concatenation Substrings String
signature: func lexicographicalConcatenationSubstringsString(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("sqGOi", "GGOGOiOOiiqqGqGOqGOissqsqGsqGOsqGOi")
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("ZhWXUKmeiI", "IKKmKmeKmeiKmeiIUUKUKmUKmeUKmeiUKmeiIWWXWXUWXUKWXUKmWXUKmeWXUKmeiWXUKmeiIXXUXUKXUKmXUKmeXUKmeiXUKmeiIZZhZhWZhWXZhWXUZhWXUKZhWXUKmZhWXUKmeZhWXUKmeiZhWXUKmeiIeeieiIhhWhWXhWXUhWXUKhWXUKmhWXUKmehWXUKmeihWXUKmeiIiiImmemeimeiI")
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("tjP kR", "  k kRPP P kP kRRjjPjP jP kjP kRkkRttjtjPtjP tjP ktjP kR")
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("qJPHNSJOUj", "HHNHNSHNSJHNSJOHNSJOUHNSJOUjJJJOJOUJOUjJPJPHJPHNJPHNSJPHNSJJPHNSJOJPHNSJOUJPHNSJOUjNNSNSJNSJONSJOUNSJOUjOOUOUjPPHPHNPHNSPHNSJPHNSJOPHNSJOUPHNSJOUjSSJSJOSJOUSJOUjUUjjqqJqJPqJPHqJPHNqJPHNSqJPHNSJqJPHNSJOqJPHNSJOUqJPHNSJOUj")
      fmt.Printf("TEST-3...%s\n", result)
      
          
  }
source_py: def lexicographical_concatenation_substrings_string(s):
      n = len(s)
      sub_count = ((n * (n + 1)) // 2)
      arr = ([0] * sub_count)
      index = 0
      for i in range(n):
          for j in range(1, ((n - i) + 1)):
              arr[index] = s[i:(i + j)]
              index += 1
      arr.sort()
      res = ''
      for i in range(sub_count):
          res += arr[i]
      return res
source_cpp: string lexicographical_concatenation_substrings_string(string s) {
    int n = s . length ( );
    int sub_count = n * ( n + 1 ) / 2;
    string arr [ sub_count ];
    int index = 0;
    for ( int i = 0;
    i < n;
    i ++ ) for ( int len = 1;
    len <= n - i;
    len ++ ) arr [ index ++ ] = s . substr ( i, len );
    sort ( arr, arr + sub_count );
    string res = "";
    for ( int i = 0;
    i < sub_count;
    i ++ ) res += arr [ i ];
    return res;
  }