StringTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Statistics : StringTools/Repeats

StringTools

 Repeats
 compute the maximal repeated substrings in a string

 Calling Sequence Repeats( s )

Parameters

 s - Maple string

Description

 • The Repeats(s) command returns an expression sequence of lists indicating the maximal repeated substrings of the input string s.
 • Each list has the form $\left[\mathrm{pos1},\mathrm{pos2},\mathrm{len}\right]$, where pos1 is the position in s at which the first member of the repeat starts, pos2 is the position in s at which the second member of the repeat starts, and len is the length of the repeated substring appearing at positions pos1 and pos2 in s.
 •

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{Repeats}\left("abcde"\right)$
 > $\mathrm{Repeats}\left("abab"\right)$
 $\left[{1}{,}{3}{,}{2}\right]$ (1)
 > $\mathrm{Repeats}\left("ababa"\right)$
 $\left[{1}{,}{5}{,}{1}\right]{,}\left[{1}{,}{3}{,}{3}\right]$ (2)
 > $\mathrm{Repeats}\left("abababa"\right)$
 $\left[{1}{,}{7}{,}{1}\right]{,}\left[{1}{,}{5}{,}{3}\right]{,}\left[{1}{,}{3}{,}{5}\right]$ (3)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam