rewrite leetcode surrounded regions