#CJam, 70 bytes, #Upvotes - 0.7

    {{_9%)A@9/#*}%}:M;rcrc),\i>:QlS-_@&{Qf#M:+}{i{Q,,M{1$)<},)Q@,=@@-}h;}?

This assumes that a valid input will be passed. Takes input from STDIN like the API spec says and prints result to STDOUT.

Examples:

    Input                Output
    
    A Z CODE GOLF        175
    a s 512              sssssjb
    A B 7                BBBA
    ≐ ⊐ ≤≫ ≥            1700

[Try it online here][1]


  [1]: http://cjam.aditsu.net/