For instance, if the input is
input_str = 'The flowers may bloom in April';
then the output is
output_str = 'The flowers may bloom in May';
Can you generalize this so there is more than one test? As it is, I can just provide the answer directly without needing to use MATLAB.
I went ahead and added some more tests.
Exchange April-May position in your example to correspond to the title of your problem
header of problem definition contradicts with example give. Please correct the given examples.
I second Dimitris' and Nick's comments.
Currently test 2 and test 3 are identical. Was test 3 perhaps supposed to be "May I come to visit you in May?" ? I notice that in each of the tests "May" always appears exactly once (not counting "may"). There should probably have been some cases where "May" doesn't appear at all, and some cases where it appears more than once in the input text.
The explaination of the question seems wrong. you are asking to replace May with April and in example you are replacing April with May
Example at top of page (beginning with 'For instance, if the input is') has April and May back to front.
I suspect this submission 'may' only work for ONE instance of "May" per test. See Solution 1461036 for an alternative syntax for the function used herein.
Get the length of a given vector
Return 'on' or 'off'
Number of digits in an integer
07 - Common functions and indexing 4
Sum of diagonal of a square matrix
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office