Cody

Problem 43101. String revert

Solution 2657690

Submitted on 6 Jul 2020 by Ramesh Kumar V
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = 'this is a sentence'; y_correct = 'sentence a is this'; assert(isequal(strRevert(x),y_correct))

words = 1×4 cell array {'this'} {'is'} {'a'} {'sentence'} y = 1×4 cell array {'sentence'} {'a'} {'is'} {'this'} y = 'sentence a is this'

2   Pass
x = 'lala tralala'; y_correct = 'tralala lala'; assert(isequal(strRevert(x),y_correct))

words = 1×2 cell array {'lala'} {'tralala'} y = 1×2 cell array {'tralala'} {'lala'} y = 'tralala lala'