Some algorithms for words decomposition