Reverse a String

Easy Strings
Reverse the characters of a given string.

Sample input

hello

Sample output

olleh

Solution

s = "hello"
print(s[::-1])
const s = "hello";
console.log(s.split("").reverse().join(""));
public class Main {
    public static void main(String[] args) {
        String s = "hello";
        System.out.println(new StringBuilder(s).reverse().toString());
    }
}
fun main() {
    println("hello".reversed())
}
let s = "hello"
print(String(s.reversed()))
void main() {
  String s = 'hello';
  print(s.split('').reversed.join());
}
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    string s = "hello";
    reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}
#include <stdio.h>
#include <string.h>

int main() {
    char s[] = "hello";
    int n = strlen(s);
    for (int i = n - 1; i >= 0; i--) putchar(s[i]);
    putchar('\n');
    return 0;
}