Problem 88. It dseon't mettar waht oedrr the lrettes in a wrod are.
Solution Stats
Problem Comments
-
4 Comments
Put more test cases in. Makes cheating too tempting.
the regexp solution is great
Adding a test case containing words with hyphens like 'hard-working' will make this problem more challenging.
Needs more test cases. Some would fail with input sIn = 'what is a chain' because of the 'ha' occurring in the middle of both in 'what' and 'chain'. Also needs test cases with hyphened words.
Solution Comments
-
2 Comments
Idk why 'ABCD-EFGH' should be ' '... Isnt it better to deal with this in a way that sOut='ACBD-EGFH' ?
Apologies, I must have forgot to update the test suite before saving.
It should be okay now.
Since the original author did not describe how hyphenated words should be treated, I won't be able to them as test cases.
-
2 Comments
Test 1 doesn't work, I literally have the same result and it fails, but test 2 passes
Your function produces sOut in string format (in the last line of the function). The test suite defines the variables as character arrays instead of strings. These two data types cannot be directly compared—i.e., you'll have to return a character array.
Also, when I run your function, it returns "hello" rather than "hlleo".
-
3 Comments
I've tried the assert in MATLAB on my desktop and it doesn't throw an error... so I'm not really sure where it's gone wrong here. I'm guessing it's something tiny I've missed. Any help?
Which version of MATLAB are you using on your desktop? I tried running your solution on MATLAB desktop version 2019a and the solution is failing with correct assertions. In order to figure out the version of MATLAB, command "ver' will get you the version.
The version of matlab is not going to affect the result. This solution removes punctuation from the input, so the '.' at the end of sentence in the second test is incorrectly removed.
-
1 Comment
Couldn't work out how to leave the punctuation in :(
-
1 Comment
Brilliant!
-
1 Comment
The test suite should add commas and other punctuation.
Problem Recent Solvers1255
Suggested Problems
-
2001 Solvers
-
What is the next step in Conway's Life?
1097 Solvers
-
10681 Solvers
-
483 Solvers
-
473 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!