intermediate cells .
elif ( ( mat [ i ] [ j ] == mat [ i - 1 ] [ j ] ) and ( mat [ i ] [ j ] == mat [ i ] [ j - 1 ] ) and ( mat [ i ] [ j ] == mat [ i - 1 ] [ j - 1 ] ) ) : NEW_LINE INDENT dp [ i ] [ j ] = ( min ( dp [ i - 1 ] [ j ] , min ( dp [ i - 1 ] [ j - 1 ] , dp [ i ] [ j - 1 ] ) ) + 1 ) NEW_LINE if ( max < dp [ i ] [ j ] ) : NEW_LINE INDENT max = dp [ i ] [ j ] NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT dp [ i ] [ j ] = 1 NEW_LINE DEDENT freq0 = [ 0 ] * MAX NEW_LINE freq1 = [ 0 ] * MAX NEW_LINE