#include using namespace std; typedef vector VI; typedef vector VVI; typedef pair PII; #include "SuffixArray.cpp" int main() { // bobocel is the 0'th suffix // obocel is the 5'th suffix // bocel is the 1'st suffix // ocel is the 6'th suffix // cel is the 2'nd suffix // el is the 3'rd suffix // l is the 4'th suffix SuffixArray suffix("bobocel"); VI v = suffix.GetSuffixArray(); assert(v[0] == 0); assert(v[1] == 5); assert(v[2] == 1); assert(v[3] == 6); assert(v[4] == 2); assert(v[5] == 3); assert(v[6] == 4); assert(suffix.LongestCommonPrefix(0, 2) == 2); return 0; }