dcg_replace//2 rewrite