Refactor Pangram solution