diff --git a/alib2algo/src/string/properties/BorderArray.h b/alib2algo/src/string/properties/BorderArray.h index f41a971da6af84116aa9117cdffe3c9651d6e942..f26d6718fabc5d2e6a4e5081bcaecd33937151c6 100644 --- a/alib2algo/src/string/properties/BorderArray.h +++ b/alib2algo/src/string/properties/BorderArray.h @@ -35,10 +35,10 @@ ext::vector<size_t> BorderArray::construct(const string::LinearString < SymbolTy res[1] = 0; for(size_t i = 1; i < w.size(); i++) { size_t b = res[i]; - while (b > 0 && w[i + 1 - 1] != w[b + 1 - 1]) + while (b > 0 && w[i] != w[b]) b = res[b]; - if(w[i + 1 - 1] == w[b + 1 - 1]) + if(w[i] == w[b]) res[i + 1] = b + 1; else res[i + 1] = 0;