def RGS_rank(rgs):
 rgs_size = len(rgs)
 rank = 0
 D = RGS_generalized(rgs_size)
 for i in range(1, rgs_size):
  n = len(rgs[(i + 1):])
  m = max(rgs[0:i])
  rank += (D[(n, (m + 1))] * rgs[i])
 return rank

def RGS_rank ( rgs ) : rgs_size = len ( rgs ) rank = 0 D = RGS_generalized ( rgs_size ) for i in range ( 1 , rgs_size ) : n = len ( rgs [ ( i + 1 ) : ] ) m = max ( rgs [ 0 : i ] ) rank += ( D [ ( n , ( m + 1 ) ) ] * rgs [ i ] ) return rank
computes the rank of a restricted growth string .