Reverse the String Problem Statement

You are given a string STR which contains alphabets, numbers, and special characters. Your task is to reverse the string.

Example:

Input:
STR = "abcde"
Output:
"edcba"

Input:

The first line of input contains a single integer 'T', representing the number of test cases.
Each test case consists of one line containing the string 'STR'.

Output:

For each test case, output the reversed string of 'STR'. Each result must be printed on a new line.

Example:

Input:
2
hello
world!
Output:
olleh
!dlrow

Constraints:

  • 1 ≤ T ≤ 10
  • 1 ≤ |STR| ≤ 10^5, where |STR| is the length of the string STR.
  • Time limit: 1 second.

Note:

Just implement the function; you do not need to print anything.

Be the first one to answer
Add answer anonymously...
Ericsson Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter