Subword( w, from, to )
Subword
returns the subword of the word w that begins at position
from and ends at position to. from and to must be positive
integers. Indexing is done with origin 1.
gap> a := AbstractGenerator("a");; gap> b := AbstractGenerator("b");; gap> w := (a^2*b)^5*b^-1; a^2*b*a^2*b*a^2*b*a^2*b*a^2 gap> Subword( w, 5, 8 ); a*b*a^2
GAP 3.4.4