title: Form Minimum Number From Given Sequence 1
signature: def form_minimum_number_from_given_sequence_1(seq):
source_py: def form_minimum_number_from_given_sequence_1(seq):
      n = len(seq)
      if (n >= 9):
          return '-1'
      result = ([None] * (n + 1))
      count = 1
      for i in range((n + 1)):
          if ((i == n) or (seq[i] == 'I')):
              for j in range((i - 1), (- 2), (- 1)):
                  result[(j + 1)] = int(('0' + str(count)))
                  count += 1
                  if ((j >= 0) and (seq[j] == 'I')):
                      break
      return result
source_cpp: string form_minimum_number_from_given_sequence_1(string seq) {
    int n = seq . length ( );
    if ( n >= 9 ) return "-1";
    string result ( n + 1, ' ' );
    int count = 1;
    for ( int i = 0;
    i <= n;
    i ++ ) {
      if ( i == n || seq [ i ] == 'I' ) {
        for ( int j = i - 1;
        j >= - 1;
        j -- ) {
          result [ j + 1 ] = '0' + count ++;
          if ( j >= 0 && seq [ j ] == 'I' ) break;
        }
      }
    }
    return result;
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(seq, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              seq),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver("D", "[2, 1]")
      print(f"TEST-0...{result}")
  
      result = driver("I", "[1, 2]")
      print(f"TEST-1...{result}")
  
      result = driver("DD", "[3, 2, 1]")
      print(f"TEST-2...{result}")
  
      result = driver("II", "[1, 2, 3]")
      print(f"TEST-3...{result}")
  
      result = driver("DIDI", "[2, 1, 4, 3, 5]")
      print(f"TEST-4...{result}")
  
      result = driver("IIDDD", "[1, 2, 6, 5, 4, 3]")
      print(f"TEST-5...{result}")
  
      result = driver("DDIDDIID", "[3, 2, 1, 6, 5, 4, 7, 9, 8]")
      print(f"TEST-6...{result}")
  
      result = driver("176297", "[7, 6, 5, 4, 3, 2, 1]")
      print(f"TEST-7...{result}")
  
      result = driver("1", "[2, 1]")
      print(f"TEST-8...{result}")
  
      result = driver("XHkhZq", "[7, 6, 5, 4, 3, 2, 1]")
      print(f"TEST-9...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.entry_fn_name: form_minimum_number_from_given_sequence_1
question_info.test_list: [{"idx": 0, "outputs": "[2, 1]", "inputs": {"seq": "D"}}, {"idx": 1, "outputs": "[1, 2]", "inputs": {"seq": "I"}}, {"idx": 2, "outputs": "[3, 2, 1]", "inputs": {"seq": "DD"}}, {"idx": 3, "outputs": "[1, 2, 3]", "inputs": {"seq": "II"}}, {"idx": 4, "outputs": "[2, 1, 4, 3, 5]", "inputs": {"seq": "DIDI"}}, {"idx": 5, "outputs": "[1, 2, 6, 5, 4, 3]", "inputs": {"seq": "IIDDD"}}, {"idx": 6, "outputs": "[3, 2, 1, 6, 5, 4, 7, 9, 8]", "inputs": {"seq": "DDIDDIID"}}, {"idx": 7, "outputs": "[7, 6, 5, 4, 3, 2, 1]", "inputs": {"seq": "176297"}}, {"idx": 8, "outputs": "[2, 1]", "inputs": {"seq": "1"}}, {"idx": 9, "outputs": "[7, 6, 5, 4, 3, 2, 1]", "inputs": {"seq": "XHkhZq"}}]
question_info.entry_cls_name: Solution