题解 | #参数解析#
参数解析
http://www.nowcoder.com/practice/668603dc307e4ef4bb07bcd0615ea677
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
int y=0;//是否在引号里,默认不在
string t="";
vector<string> v;
while(getline(cin, s)){
for(int i=0;i<s.size();++i){
if(s[i]=='"'){
y++;
}else if(s[i]==' '&&y%2==0) {v.push_back(t);t.clear();}
else t+=s[i];
}
v.push_back(t);
cout<<v.size()<<endl;
for(int i=0;i<v.size();++i){
cout<<v[i]<<endl;
}
}
return 0;
}