Untitled
unknown
plain_text
2 years ago
250 B
6
Indexable
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; }};
Editor is loading...