Problem 2151. Reverse within string
If input is a string 'yellow' the output should be 'leywol'. Locate the middle of the string and reverse the first (yel) and second (low)parts of the string.
If the length of the string is odd, leave the middle letter unchanged.
Input 'letter' output 'telret'
Input 'apple' output 'papel'
Solution Stats
Problem Comments
-
1 Comment
goc3
on 27 Sep 2017
Additional test cases have been added.
Solution Comments
Show commentsProblem Recent Solvers102
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15334 Solvers
-
1392 Solvers
-
742 Solvers
-
Create an n-by-n null matrix and fill with ones certain positions
552 Solvers
-
Determine the length of a string of characters
246 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!