Problem 171. Reverse the Words (not letters) of a String
Solution Stats
Problem Comments
-
1 Comment
Eagle wangzhaowu
on 18 Apr 2020
s2='';
s1=[' ',s1];
a=findstr(s1,' ');
a=[a length(s1)];
for i=length(a):-1:2
s2= strcat(s2,s1(a(i-1):a(i)));
end
s2(:,1)=[];
Problem Recent Solvers330
Suggested Problems
-
4243 Solvers
-
Get the area codes from a list of phone numbers
792 Solvers
-
Back to basics 18 - justification
183 Solvers
-
258 Solvers
-
Duplicate each element of a vector.
548 Solvers
More from this Author56
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!