A Mahler’s theorem for functions from words to integers