EDIT This was posted BEFORE the rules changed to disallow sum
...
The R language: No calls to +
or -
... And 9 tie-breaker characters!
sum(as.numeric(readLines(n=2)))
Example:
> sum(as.numeric(readLines(n=2)))
123
456
[1] 579
The [1] 579
is the answer 579 (the [1]
is to keep track of where in the result vector your are since in R all values are vectors - in this case of length 1)
Note that R has +
operators just like most languages - it just so happens that it has sum
too that sums up a bunch of vectors.
In this case, readLines
returns a string vector of length 2. I then coerce it to numeric (doubles) and sum it up...
Just to show some other features of R:
> 11:20 # Generate a sequence
[1] 11 12 13 14 15 16 17 18 19 20
> sum(1:10, 101:110, pi)
[1] 1113.142