forked from vijay532/CompetitiveSources
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringStream.cpp
More file actions
46 lines (43 loc) · 857 Bytes
/
StringStream.cpp
File metadata and controls
46 lines (43 loc) · 857 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
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
clear() — to clear the stream
str() — to get and set string object whose content is present in stream.
operator << — add a string to the stringstream object.
operator >> — read something from the stringstream object
stringstream class is extremely useful in parsing input.
*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
/*
2
2
3 5
8 100
3
5 100 1
2
5 100
*/
int main()
{
ll t,n,i,l,r,sum,temp,rem;
cin>>t;
while(t--)
{
string s;
cin>>n;
string str;
ll count=0;
for(i=0;i<n;i++)
{
getline(cin,str);
stringstream s(str);
string word;
while(s >> word)
{
count++;
cout<<word<<" "<<endl;
}
}
}
}