Bottom-up rewriting for words and terms. (March 2015)