I would get 4 AVR Mega8 chips, 2 for input side and 2 for output (LED) side. There are, I think, 23 I/O pins. Make one TX on one pair, and other (output side) make one pin of each chip RX. Write a program to read 22 inputs, and send a bit pattern via RS232 of the input pair to the output pair. I say pair, since you have 22 pin on a chip you can use and you need 40+. That would give you 44 inputs, 2 RS232 signals to 44 OUTPUTS. Only requiring 4 wires, POWER, GROUND, DATA1 (TX1/RX1) and DATA2 (TX2/RX2).
I would use RVKBASIC to write the software. But that would be my approch.