-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path0074.cpp
More file actions
33 lines (31 loc) · 685 Bytes
/
0074.cpp
File metadata and controls
33 lines (31 loc) · 685 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 0074.参数解析
#include <iostream>
#include <vector>
using namespace std;
int main()
{
string s;
while(getline(cin, s))
{
vector<string> v;
s += ' ';
while(!s.empty())
{
if(s[0] == '"') {
int f = s.find('"', 1);
v.push_back(s.substr(1, f-1));
s = s.substr(f+2);
}else{
int f = s.find(' ');
v.push_back(s.substr(0, f));
s = s.substr(f+1);
}
}
cout << v.size() << endl;
for(int i = 0; i < v.size(); i++)
{
cout << v[i] << endl;
}
}
return 0;
}