Exercise - Complete a challenge to reverse words in a sentence

Completed

Code challenges reinforce what you've learned and help you gain some confidence before continuing on.

Many times you'll need to combine several of the ideas covered in this module into a single solution. You should work to decompose a larger problem into lots of mini-problems, then use the various ideas in this module to solve each mini-problem.

Write code to reverse each word in a message

  1. Select and delete all code lines in the Visual Studio Code Editor.

  2. Update your code in the Visual Studio Code Editor as follows:

    string pangram = "The quick brown fox jumps over the lazy dog";
    
    
  3. Write the code necessary to reverse the letters of each word in place and display the result.

    In other words, don't just reverse every letter in the variable pangram. Instead, you'll need to reverse just the letters in each word, but print the reversed word in its original position in the message.

    Your code must produce the following output:

    ehT kciuq nworb xof spmuj revo eht yzal god
    
    

Important

This is a particularly difficult challenge. You will need to combine many of the concepts you learned in this exercise, including the use of the Split(), ToCharArray(), Array.Reverse(), and String.Join(). You'll also need to create multiple arrays, and at least one iteration statement.

Good luck! Just keep decomposing the problem into small steps, then solve that particular step before moving to the next.

Whether you get stuck and need to peek at the solution or you finish successfully, continue on to view a solution to this challenge.