Problem 171. Reverse the Words (not letters) of a String
Solution Stats
Problem Comments
-
1 Comment
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
-
1966 Solvers
-
Find common elements in matrix rows
1847 Solvers
-
Calculate the Levenshtein distance between two strings
769 Solvers
-
416 Solvers
-
199 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!