$X$ and $Y$ are two topological spaces. $f$ is a surjection. For $A \subset X$, $(f(A))^0 \subset f(A^0)$. Show that $f$ is continuous. 
Let $(X,\mathscr{T}_X)$ and $(Y,\mathscr{T}_Y)$ be two topological spaces. $f: X \rightarrow Y$ is a surjection such that for any $A \subset X$, $(f(A))^0 \subset f(A^0)$(Here $A^0$ denote the interior of $A$). Show that $f$ is continuous.

As required, I need to show that given $B \in \mathscr{T}_Y$, $f^{-1}(B)$ is open. Let $A = f^{-1}(B)$. Since $f$ is surjection, we have $f(A) = f(f^{-1}(B)) = B$. By assumption we have
$$
B = B^0 = (f(A))^0 \subset f(A^0) \subset f(A) = B
$$
Hence $f(A^0) = B$. I was stopped here. One of my friend "proved" by claiming that $f(A^0) = B$ implies $A^0 = f^{-1}(f(A^0)) = f^{-1}(B)$. However, I think such argument is wrong since given any set $D$, we only have $D \subset f^{-1}(f(D))$(For example, $D_1 = [0,1]$ and $D_2 = [2,3]$, and $f \equiv 1$ on $D_1 \bigcup D_2$. Then $D_1 \subsetneqq f^{-1}(f(D_1)) = D_1 \bigcup D_2$). Any hint will be appreciated. 

This came up as a topology atlas question a long time ago; this is the answer we came up with there:
Let $x \in X$ and $y = f(x)$ and let $V$ be an open set containing $y$; we need to find an open set $O$ containing $x$ such that $f[O] \subset V$. 
To this end, set $U = f^{-1}[V \setminus \{y\}] \cup \{x\}$.
By surjectivity, $f[U] = V$ and the only point in $U$ mapping to $y$ is $x$.
We now use our assumption: $V = V^\circ = f[U]^\circ \subset f[U^\circ] \subset f[U] = V$.
This means that $f[U^\circ] = V$ (note that this is quite similar to your argument). But as $x$ is the only point mapping to $y$ under $f$, it must be that $x \in U^\circ$, and so we can take $O = U^\circ$, and we are done: $f$ is continuous at $x$.
