Using front() and back() instead of calculations
In many functions, accessing last or first element of vector, string was based on calculation of size() or length() function. However, front() and back() functions can be used instead of those calculations.