I just changed both of the 5's in those two for loops to 4's. I am still getting the same error message, but the program prints the four recommended digits this time as all 0's, which is incorrect but progress :)
Correction, changed it in all of the loops and am now getting no error message, but I am still printing out all 0's for the recommended numbers, so the problem is now somewhere in my logic instead my syntax.
The idea was to find the least used digits in the 10 element vector, and then put their positions (which represent the digits 0-9, the elements represent the number of times they are used in the text file) in the 4 element vector. When an element is chosen and put into the 4 element vector, its value is changed to -1 so that it will not be chosen again.