string reverser code example
Example 1: reverse string in python
'hello world'[::-1]
'dlrow olleh'
Example 2: string reverse in java
String str = "Hello";
String reverse(String str){
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.reverse();
return sb.toString();
}
Example 3: reverse a string
let t = s.chars().rev().collect::<String>();