Untitled
plain_text
25 days ago
250 B
2
Indexable
Never
class Solution { public: int lengthOfLastWord(string s) {string y;int n=s.length();int j=0; reverse(s.begin(),s.end()); int i=0; while(s[i]==' ') { i++; } j=i+1; while(s[j]!=' ') { j++; } return j-i; }};