Question: Inputs: (char) The corrupted message (char) The string used to fix the message Outputs: 1. (char) The fixed message Background: Every friend group has the

Inputs:

  1. (char) The corrupted message

  2. (char) The string used to fix the message

Outputs:

1. (char) The fixed message

Background:

Every friend group has the one friend who owns an Android phone and sends green texts in the group chat. One day, that friend sent a text that got corrupted so that some letters in the message were replaced by question marks, and in an attempt to redeem themselves, they sent a second text with seemingly random letters. Replacing the question marks in the first text with the corresponding letters from the second text is the only way to fix the text and understand what the friend wanted to say.

Function Description:

Given two character vectors, replace all the question marks in the first string with the corresponding letters from the second string.

Example:

str1 = 'And id is ?ct?a?ly ?uper?or!' str2 = 'htu mngth aojuelioxsokdeioro' fixedStr = corruptedMessage(str1, str2) fixedStr 'Android is actually superior!'

Notes:

The two strings are guaranteed to be the same length.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!