Home / Expert Answers / Computer Science / given-a-string-s-which-consists-of-lowercase-letters-from-a-to-z-and-spaces-can-you-out-pa975

(Solved): Given a string S which consists of lowercase letters from a to z and spaces, can you out ...



Given a string S which consists of lowercase letters from ‘a’ to ‘z’ and spaces, can you output the string again but in reverse order?

Note: please use function and recursion to solve this problem.

Format Input 

The first line of the input containsT, which is the number of testcases. Each testcase consists of a single line consisting of string S

Format Output 

For each test case, output one line containing “Case #X: ” (without quotes) where X is the test case number (starting from 1) and then followed by the string S in reverse order.

Constraints 

• 1 ? T ? 100 

• 1 ? |S| ? 1000 (|S| means the length of string S) 
S only consists of lowercase letters from ‘a’ to ‘z’ and spaces

Sample Input (standard input)

3
trouble in town
when i need a friend
champion of the world

Sample Output (standard input)

Case \#1: nwot ni elbuort
Case \#2: dneirf a deen i nehw
Case \#3: dlrow eht fo noipmahc

 

DO IT IN C LANGUAGE - BECAUSE THIS IS ALGORITHM & PROGRAMMING!

3 trouble in town when i need a friend champion of the world Case \#1: nwot ni elbuort Case \#2: dneirf a deen i nehw Case \#3: dlrow eht fo noipmahc


We have an Answer from Expert

View Expert Answer

Expert Answer


include void printReverse(char string[], int i){ // recursive function which prints in reverse order, i is the index of current character we
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe