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_1 = len ( var_0 )
      var_2 = list ( range ( 1 , var_1 + 2 ) )
      var_3 = 0
      while var_3 < var_1 :
          var_4 = var_3
          while var_4 < var_1 and var_0 [ var_4 ] == 'D' :
              var_4 += 1
          var_2 [ var_3 : var_4 + 1 ] = var_2 [ var_3 : var_4 + 1 ] [ : : - 1 ]
          var_3 = max ( var_3 + 1 , var_4 )
      return var_2
  