很容易的题,找空格和空格前面不是空格的。
class Solution {
public:
int countSegments(string s) {
int cnt=0,cot=0;
bool flag=false;
if (s=="")
return 0;
for (int i =0;i

很容易的题,找空格和空格前面不是空格的。
class Solution {
public:
int countSegments(string s) {
int cnt=0,cot=0;
bool flag=false;
if (s=="")
return 0;
for (int i =0;i