Which of the following function is used to show reverse of string code example
Example 1: reverse a string
let t = s.chars().rev().collect::<String>();
Example 2: reverse the string
#!/bin/bash
input="$1"
reverse=""
len=${#input}
for (( i=$len-1; i>=0; i-- ))
do
reverse="$reverse${input:$i:1}"
done
echo "$reverse"