samedi 3 juillet 2021

Write a program which takes input as string and outputs the reverse of each word using a given pattern [closed]

Write a program which takes input as string and outputs the reverse of each word using a pattern as given in following examples. In pattern, each number represents the position of word in given string: [ Ideal Time : 45 mins - 1 hr ]

Example 1:

Input : A dead fox found in the forest

Output : tserof ni eht dnuof xof A daed

Patt : 7 5 6 4 3 1 2

Example 2:

Input : A dead fox found in the deep forest

Output : tserof eht peed in dnuof daed xof A

Patt : 8 6 7 5 4 2 3 1

Aucun commentaire:

Enregistrer un commentaire