Can you please explain how is the output in the console working after .each statement.

In the each statement, we're defining a variable with |word| which will represent the current element of the array we're working on (because the split method returns an array).Then we use an if/else statement to print REDACTED if the current element is equal to the word we're looking for (redact). If it's not the correct word, we just print it normally. We also add the space.

Note that using word as a variable even though our array is also called word is a bit problematic for reading purposes (it doesn't seem to cause a problem for Ruby because I assume the array called word is outside of the scope of the block (the {}), but I'm no expert). A better alternative would be to choose something different from the name of the array, like a simple w for example.