Hidden Markov Model for categorizing letters