You get the string::npos
value returned, because the library thinks that it cannot find -a
in the string.
The reason for this is that you use different dashes a long dash –
in the string and a short dash -
in the search string.
Once you replace the character with the correct one in both places, your code starts working fine (demo).