text: idx [ i ] stores the next available index of ( ' a ' + i ) in occur [ i ]
code: idx = [ 0 ] * ( 26 ) NEW_LINE poss = True NEW_LINE for x in range ( n ) : NEW_LINE INDENT ch = ord ( t [ x ] ) - ord ( ' a ' ) NEW_LINE DEDENT