This problem can be solved by pre-school children in five to ten minutes by programmers is an hour and by people with higher education.....well check it yourself
8809=6 5555=0
7111=0 8193=0
2172=0 8096=5
6666=4 1012=1
1111=0 7777=0
3213=0 9999=4
7662=0 7756=1
9313=1 6855=3
0000=4 9881=5
2222=0 5531=0
3333=0 2581=???