Optoisolator Circuit

Ground the emitters, Collectors to i/o as INPUT_PULLUP. The logic will be "upside down" since the collector-emitter gate will close with the led input high and thus take your i/o pin low, but that's easy to take care of in code.

edit.... each segment looks like the circuit shown here but with the internal pullup instead.