Prefixed size_t with std:: and replaced the while with a for loop.