t = 1: We where at the beginning and have found at least one legal character (letter, number, underscore, period).
Python, 149 chars (after putting the whole for loop into one semicolon-separated line, which I haven't done here for "readability" purposes): def v(s,t=0,o=1):įor c in cases, borrowed from strager's answer: assert not not not not not not not "Yeah!"Įxplanation: When iterating over the string, two variables keep getting updated. To char*A="_.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" To make this code more "portable" (heh :-P) you can change the array-building code from char A="_.0123456789Aa" short*s=A+12 for( ++s