Back to the Problem
Test the three character-class flags in one pass plus the length.
Complexity: O(|S|)