Is brevity (in terms of kb) important for this snippets? If not, I think having more explicit variable names (`string` or even `str` instead of `s`) would be better for the purpose of understanding them in less than 30 seconds.
I agree with you, brevity, as far as quantity of code required to accomplish the goal is concerned, but too many times brevity is confused for compactness, which to me, is the opposite of what you would want with these.