comefrom: <doocs>0484.Find Permutation_1.py
code: def findPermutation( s: str) -> List[int]:
      n = len(s)
      ans = list(range(1, n + 2))
      i = 0
      while i < n:
          j = i
          while j < n and s[j] == 'D':
              j += 1
          ans[i: j + 1] = ans[i: j + 1][::-1]
          i = max(i + 1, j)
      return ans
masked: def sample_funcname ( var_0 : str ) -> List [ int ] :
      var_5 = len ( var_0 )
      var_10 = list ( range ( 1 , var_5 + 2 ) )
      var_12 = 0
      while var_12 < var_5 :
          var_13 = var_12
          while var_13 < var_5 and var_0 [ var_13 ] == 'D' :
              var_13 += 1
          var_10 [ var_12 : var_13 + 1 ] = var_10 [ var_12 : var_13 + 1 ] [ : : - 1 ]
          var_12 = max ( var_12 + 1 , var_13 )
      return var_10
  