56 const std::string text =
"ababa";
60 std::cout <<
"Suffix Automaton Example\n";
61 std::cout <<
"Text: " << text <<
"\n";
62 std::cout <<
"States: " << sam.
state_count() <<
"\n";
64 std::cout <<
"Contains 'bab'? " << (sam.
contains(
"bab") ?
"yes" :
"no") <<
"\n";
66 const std::string other =
"zzabxababa";
67 std::cout <<
"LCS(text, '" << other <<
"') = "
Suffix structures: suffix array/LCP, suffix tree, suffix automaton.
Suffix automaton (SAM) over byte alphabet.
std::string longest_common_substring(const std::string_view other) const
Find the longest common substring between the built SAM text and other.
void build(const std::string_view text)
Build the SAM from an entire string.
bool contains(const std::string_view pattern) const
Return true if pattern is a substring of the built text.
size_t distinct_substring_count() const
Count the number of distinct substrings in the built text.
size_t state_count() const noexcept
Return the number of states in the SAM.
Main namespace for Aleph-w library functions.
int main()
Demonstrates basic usage of the Suffix_Automaton API with a sample string.