Yasir was traveling from Chennai to Bangalore by bus. He looking the LED display board for the destination place name on the bus. But it shows the reflection of the destination place name in reverse. can you write the code to change the display in reverse order?
Input:
The input line must be a string.
Output:
Print reverse a string.
#include <stdio.h> int main() { char *sptr;char *rptr; char s[20];int i=0; scanf("%[^\n]s",s); sptr = s;rptr = sptr; //you can use strlen to find length of the string while(*sptr!='\0'){ sptr++; i+=1;} while(i>=0){ printf("%c",*(rptr+i)); i--;} return 0; }
INPUT_1:
erolagnaB
OUTPUT:
Bangalore
INPUT_2:
iabmuM salem
OUTPUT:
melas Mumbai
INPUT_3:
fcuk the code
OUTPUT:
edoc eht kucf
INPUT_4:
edoc eht kucS
OUTPUT:
Scuk the code
INPUT_5:
edoc eht kucf olleh
OUTPUT:
hello fcuk the code
ILLUSTRATION
Morae Q!
- Find the length of the array’s longest increasing sub-sequence.
- Arrange numbers in a circle so that any two neighbouring numbers differ by 1.
- Find partial names and count the total numbers.
- Find the minimized sum of non-deleted elements of the array after the end of the game.
- Find the maximum number of good sleeping times optimally.
- Sort the elements of the array in the order in which they are required.
- Find the minimum number of flats, monkey needs to visit to catch ninjas.
- Convert the square matrix to matrix in Z form.
- Shift the K elements of each row to right of the matrix.
- Find maximum possible number of students in a balanced team with skills.
- Find the Maximum number of pairs of points you can match with each other.
- Calculate the number of non-empty good subarrays of given array.
- Transform the binary string A into the string B using finite operations.
- Find the number of potion must the character take to jump the hurdles.
- Count the total number of vowels and consonants.
- Return all elements of the matrix in spiral order.
- Return all palindromic paths of the matrix.
- Write the code to change the display in reverse order using pointer.
- Find the number of days the expedition can last.
- Find the minimum size of the sub-segment to make the array pairwise distinct.