c++/pbbslib/examples/longest_repeated_substring.cpp
tuple<uint,uint,uint> lrs(sequence<uchar> const &s) {
  timer t("lrs", true);

  sequence<uint> sa = suffix_array<uint>(s);
  t.next("suffix array");

  sequence<uint> lcps = lcp(s, sa);
  t.next("lcps");

  size_t idx = max_element(lcps, std::less<uint>());
  t.next("max element");
    
  return tuple<uint,uint,uint>(lcps[idx],sa[idx],sa[idx+1]);
}
// returns
//  1) the length of the longest match
//  2) start of the first string in s
//  3) start of the second string in s
returns
1) the length of the longest match
2) start of the first string in s
3) start of the second string in s
returns 1 ) the length of the longest match 2 ) start of the first string in s 3 ) start of the second string in s
tuple<uint,uint,uint> lrs(sequence<uchar> const &s) {
  timer t("lrs", true);
  sequence<uint> sa = suffix_array<uint>(s);
  t.next("suffix array");
  sequence<uint> lcps = lcp(s, sa);
  t.next("lcps");
  size_t idx = max_element(lcps, std::less<uint>());
  t.next("max element");
  return tuple<uint,uint,uint>(lcps[idx],sa[idx],sa[idx+1]);
}
tuple < uint , uint , uint > lrs ( sequence < uchar > const & s ) { timer t ( " " , true ) ; sequence < uint > sa = suffix_array < uint > ( s ) ; t . next ( " " ) ; sequence < uint > lcps = lcp ( s , sa ) ; t . next ( " " ) ; size_t idx = max_element ( lcps , std :: less < uint > ( ) ) ; t . next ( " " ) ; return tuple < uint , uint , uint > ( lcps [ idx ] , sa [ idx ] , sa [ idx + 1 ] ) ; }
returns
1) the length of the longest match
2) start of the first string in s
3) start of the second string in s
returns 1 ) the length of the longest match 2 ) start of the first string in s 3 ) start of the second string in s