Check if encountered '0' then add number of strings of current window and change the values for both l and r
else : NEW_LINE INDENT ans += ( ( r - l ) * ( r - l + 1 ) ) // 2 NEW_LINE l = r + 1 NEW_LINE r += 1 NEW_LINE DEDENT