classSolution { public: intlengthOfLastWord(strings) { inta=0; inti=s.size()-1; { while(i>=0&&s[i]==' '){ i--; }while(i>=0&&s[i]!=' '){ i--; a=a+1; } } returna; } };
classSolution { public: intlengthOfLastWord(strings) { inta=0; inti=s.size()-1; { while(i>=0&&s[i]==' '){ i--; }while(i>=0&&s[i]!=' '){ i--; a=a+1; } } returna; } };