Skip to content

434-number-of-segments-in-a-string

DevGod
DevGod
Vtuber
/**
* @param {string} s
* @return {number}
*/
var countSegments = function(s) {
if(s.trim() == ""){ return 0; }
return s.trim().split(/\s+/g).length;
};