used each char and preinitialized ranges
improved spacing