It looks like num holds the number of occurrences of a given letter in string s (each element represents a letter in the alphabet). a is zero, z is 25. index holds the index of the last element in s where a letter was found, using the same convention.
The s[i] - 'a' expression is meant to convert whatever value a is in ascii into 0, and so on. I'm not sure that whitespace is meant to be there, as the code only seems to be meant to work with lower case letters. It will probably cause an attempt to write outside the array.
Thanks for the reply, but I still feel confusing about the statement:
"The s[i] - 'a' expression is meant to convert whatever value a is in ascii into 0, and so on. "
say i=2, then s[i]=b, how s[i]-'a'is meant to convert whatever value a is in ascii into 0?