Update project4b.cpp

Changed prevCounter to prevIndex so that it makes sense.