Outer loop picks starting character and inner loop picks ending character .
n = len ( str1 ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT hash = dict ( ) NEW_LINE for j in range ( i , n ) : NEW_LINE DEDENT