Check for emptiness instead size > 0

From cppcheck:

Checking for 'st' emptiness might be inefficient. Using st.empty() instead of st.size() can be faster. st.size() can take linear time but st.empty() is guaranteed to take constant time.