flag transformation on a sequence using only one flag