I think this is not a sufficient specification of requirements.
I think it's fine.
For example, it mentions »changes« in line two, but before line
two, it was not said that anything should be changed at all. So
it is not clear what »changes« refers to.
changes == replacements
And »to count« something is not behavior that is visible from the
A lot of find-replace programs count and report how many replacements
BTW: When given the task
»replace all the occurences of "abcabc" by "defdef" in
"012defdefdef789" be a correct result? the only correct result?«
An incorrect result.
After the first find-replace of 'abcabc' by 'defdef', there is no more
"012abcabcabc789" would become "012defdefabc789"
and the program would increment the counter and continue on.
This is how my original code handles it, and how the other
implementations found in text apps (LibreOffice Writer, gEdit, Leafpad,
etc) I looked at handle it.
Another Stefan Ram fail post, like your first one in this thread.