Comments on Reverse an ASCII string
Parent
Reverse an ASCII string
Your goal is to reverse an ascii string. Given a (optionally newline or null terminated) input, output your input in reverse order, optionally followed by a newline. Terminate afterward. Function answers will not be given a newline, and are not expected to output one unless they print the answer to console.
Examples
Assume all inputs are followed by a newline, and are all standard ASCII encoded.
abcdef
-> fedcba
Hello, World!
-> !dlroW ,olleH
racecar
-> racecar
Example program
function solution(x) {
return x.split("").reverse().join("");
}
Further clarifications
- No, you don't have to handle nulls correctly.
- Nor empty inputs.
[Brain-Flak], 12 bytes …
4y ago
[Ahead], 3 bytes SW@ …
4y ago
[C (gcc)], 34 bytes …
4y ago
JavaScript, 25 24 bytes -1 …
3y ago
jq, 16 bytes, preferably `-rR` …
3y ago
C, 66 59 bytes -7 bytes tha …
4y ago
[Python 3], 20 bytes …
3y ago
[Shakespeare Programming Langu …
4y ago
C (gcc), 62 bytes main( …
3y ago
Japt, 1 byte w Uh... …
4y ago
Turing Machine.io, 363 bytes …
3y ago
[PowerShell], 43 bytes …
3y ago
Scala, 9 bytes ```scala .rev …
3y ago
[Perl 5] `-p`, 10 bytes …
3y ago
[Ruby], 14 bytes -> …
4y ago
Laser, 9 bytes ``` c⌜ps …
4y ago
[Haskell], 7 bytes …
3y ago
[Sclipting], (UTF-16) 2 bytes …
3y ago
[Lua], 32 bytes pri …
3y ago
[Bash], 3 bytes rev …
4y ago
Befunge-98, 45 39 37 33 29 21 …
4y ago
Python, 16 bytes ```python …
1y ago
J, 2 bytes ```J |. ``` …
3y ago
[shortC], 24 bytes f(Cs …
3y ago
Rockstar, 67 bytes list …
3y ago
[PHP], 32 24 bytes …
3y ago
[AWK], 48 bytes ORS=""; …
6mo ago
Standard ML, 23 bytes i …
1y ago
R, 32 bytes ```r \(s)intTo …
1y ago
R + magrittr, 31 bytes …
1y ago
Brainfuck, 10 Bytes ```,[ …
1y ago
SOS, 76 bytes +>+>????? …
2y ago
[Java (JDK)], 88 83 bytes …
3y ago
1 comment thread