b,o=input(),""for a,n in zip(b,b[1:]):o+=`a`+"-"*(a%10==1and a+n in(2,3,12,13))print o+`b[-1]`
[2,12,12,2,1,12,12,1,1,2,12,12,2,11,2,12,1]
2121221-12121-1-21212211-2121
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!