Decrement Instead Of Jump

vector<int> prefix_function(string s) {
    int n = s.length();
    vector<int> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = j - 1;              // line 7: should be j = pi[j-1]
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}

The fallback on line 7 decrements instead of jumping through the table. It still terminates and it still returns the right answer for "aabaaab" and for "abcabcd". Which input exposes it, and what does it return?

A

Nothing exposes it. Decrementing reaches every candidate length that pi[j-1] reaches, just more slowly.

B

"ababb": it returns [0, 0, 1, 2, 2] instead of [0, 0, 1, 2, 0].

C

"aaaaa": it returns [0, 1, 2, 3, 3] instead of [0, 1, 2, 3, 4].

D

Any string of length 10610^6 with no repeated character. The values stay correct but the loop becomes quadratic.