c++ stringstream


  • 0
    H
    class Solution {
    public:
        int countSegments(string s) {
            stringstream ss(s);
            int i=0;
            string buff;
            while(ss>>buff) i++;
            return i;
        }
    };
    

Log in to reply
 

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