a: $(foreach s,$(subst $% ,X,$(STDIN)),$(word 1,$(foreach i,1 2 3 4 5 6 7 8 9,$(if $(findstring $i$i$i,$(subst X,$i,$s)),$i)) 1))