Reduced the usage of variables in the rfind and count functions.
Replaced calls to drop_front with direct use of substr in consume_front,
since starts_with already performs length check on the string. Did the same
for other functions.
Using the std::clamp in slice makes the code more straightforward.