If you're going to count back two characters from the end of a string you first need to make sure that the string is at least two characters long, otherwise you'll be attempting to read characters at negative indices (i.e. before the start of the string):
if (word.length() >= 2) // if word is at least two characters long
{
slc = word.length() - 2; // access the second from last character
// ...
}