R, 35 characters 35 characters (sum of 3086) 26 bytes (sum of 30862305)
sum(as.real(charToRawutf8ToInt(readline())))
Not particularly inventive, apart maybe from the coercion to a numerical form using as.real
instead of the more natural as.integer
. charToRaw
really does all the work. readline()
is one character longer than scan(,"")
but scan
split the input on spaces by default.
Usage:
> sum(as.real(charToRawutf8ToInt(readline())))
Hello World!
[1] 1085
> sum(as.real(charToRawutf8ToInt(readline())))
sum(as.real(charToRawutf8ToInt(readline())))
[1] 30862305
> sum(as.real(charToRawutf8ToInt(readline())))
q/%8hnp>T%y?'wNb\},9krW &D9']K$n;l.3O+tE*$*._B^s!@k\&Cl:EO1zo8sVxEvBxCock_I+2o6 yeX*0Xq:tS^f)!!7=!tk9K<6#/E`ks(D'$z$\6Ac+MT&[s[]_Y(`<g%"w%cW'`c&q)D$0#C$QGf>?A$iawvc,}`9!('`c&q)D$0#C$QGf>?A$iawvc,}`9!(
[1] 14835