calculating for string S
for i in range ( Len ) : NEW_LINE INDENT if ( k [ i ] == " a " ) : NEW_LINE INDENT a += 1 NEW_LINE DEDENT if ( k [ i ] == " b " ) : NEW_LINE INDENT b += 1 NEW_LINE DEDENT if ( a > b ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT