Counting the number of matching characters in two ASCII strings



Suppose that you give me two ASCII strings having the same number of characters. I wish to compute efficiently the number of matching characters (same position, same character). E.g., the strings ‘012c’ and ‘021c’ have two matching characters (‘0’ and ‘c’). Though I seem to restrict the problem to ASCII inputs, my code actually counts the number of matching bytes. I leave it as an exercise for the reader to write a function that counts the number of matching characters within a range, or to determine whether all characters in a given range match.


59.03% objective
48.30% positive


VARIETY - ‘Donkey Hodie’ Puppeteers Bring Classic ‘Mister Rogers’ Characters to Life for a New Generation
-12.49% LESS objective
16.67% MORE positive

Other reimagined “Mister Rogers” characters also inhabit the magical land of Someplace Else (Purple Panda, Bob Dog and Harriet Elizabeth Cow) as do new ones (Duck Duck, Clyde the Cloud and Stanley, a giant dragon). Character designs of Donkey Hodie for PBS puppet series “Donkey Hodie.” Initial sketch drawn by David Rudman and the animated images (middle) created by Dave Pryor. Adds David Rudman, who directs and is the puppeteer for Grampy Hodie and other characters: “We kind of blur the line between puppetry and stop-motion animation in some ways. “There is a little bit of blue screen, green screen, a tiny bit of digital effects,” David Rudman says. Right now, there are two Donkey Hodie and two Duck Duck puppets, but for the rest of the regular puppets, there’s only one version.