Пример #1
0
    public bool RotateString(string A, string B)
    {
        if (A.Length == 0 && B.Length == 0)
        {
            return(true);
        }
        if (A.Length != B.Length)
        {
            return(false);
        }

        var A1  = A + A;
        var kmp = new KMP();

        var res = kmp.KMPSearch(A1, B);

        return(res >= 0);
    }