functions to get max length of tokens of a given type from a char stream
added longestTokenType function, which, given a stream of chars, returns the type of the longest matching token