4 line in c++


  • 0
    A
    class Solution
    {
    public:
    	int lengthOfLastWord(string s)
    	{
    		istringstream sin(s);
    		string temp;
    		while (sin >> temp);
    		return temp.size();
    	}
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.