val f
= (n
:Int
)=>{val s
=n.
toString;(for{c
<-s
if c
!='-'}yield(c-
48)*(if(s.
indexOf(c
)==1&&s.
charAt(0)=='-') -
1 else 1)).
sum+n+s.
length} println(f(99))
println(f(-123))
println(f(0))
println(f(-1))
}
b2JqZWN0IE1haW4gZXh0ZW5kcyBBcHAgewoJdmFsIGYgPSAobjpJbnQpPT57dmFsIHM9bi50b1N0cmluZzsoZm9ye2M8LXMgaWYgYyE9Jy0nfXlpZWxkKGMtNDgpKihpZihzLmluZGV4T2YoYyk9PTEmJnMuY2hhckF0KDApPT0nLScpIC0xIGVsc2UgMSkpLnN1bStuK3MubGVuZ3RofQoJcHJpbnRsbihmKDk5KSkKCXByaW50bG4oZigtMTIzKSkKCXByaW50bG4oZigwKSkKCXByaW50bG4oZigtMSkpCn0=