Code rewrite due to badly remembered task.
Implementation of character type recognition.