title: Lexicographical Concatenation Substrings String
signature: pub fn lexicographical_concatenation_substrings_string(s: String) -> String {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: String, expected: String)->bool{
  return actual==expected
  }
  pub fn driver(s: String, expected: String)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(s), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        "sqGOi".to_string(), 
        "GGOGOiOOiiqqGqGOqGOissqsqGsqGOsqGOi".to_string()
      ));
      
      println!("TEST-1...{}", driver(
        "ZhWXUKmeiI".to_string(), 
        "IKKmKmeKmeiKmeiIUUKUKmUKmeUKmeiUKmeiIWWXWXUWXUKWXUKmWXUKmeWXUKmeiWXUKmeiIXXUXUKXUKmXUKmeXUKmeiXUKmeiIZZhZhWZhWXZhWXUZhWXUKZhWXUKmZhWXUKmeZhWXUKmeiZhWXUKmeiIeeieiIhhWhWXhWXUhWXUKhWXUKmhWXUKmehWXUKmeihWXUKmeiIiiImmemeimeiI".to_string()
      ));
      
      println!("TEST-2...{}", driver(
        "tjP kR".to_string(), 
        "  k kRPP P kP kRRjjPjP jP kjP kRkkRttjtjPtjP tjP ktjP kR".to_string()
      ));
      
      println!("TEST-3...{}", driver(
        "qJPHNSJOUj".to_string(), 
        "HHNHNSHNSJHNSJOHNSJOUHNSJOUjJJJOJOUJOUjJPJPHJPHNJPHNSJPHNSJJPHNSJOJPHNSJOUJPHNSJOUjNNSNSJNSJONSJOUNSJOUjOOUOUjPPHPHNPHNSPHNSJPHNSJOPHNSJOUPHNSJOUjSSJSJOSJOUSJOUjUUjjqqJqJPqJPHqJPHNqJPHNSqJPHNSJqJPHNSJOqJPHNSJOUqJPHNSJOUj".to_string()
      ));
      
  }
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;
  }