import re def f(m):c=m.group().count;return'10'[c('1')