in reply to How to avoid the duplication in a string

$ perl -le' $_ = "aabbccdddd"; print; tr///cs; print; ' aabbccdddd abcd