forked from vijay532/CompetitiveSources
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReverseStringName
More file actions
43 lines (39 loc) · 714 Bytes
/
ReverseStringName
File metadata and controls
43 lines (39 loc) · 714 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
#include<bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
long long i,j,k,t;
cin>>t;
string sp;
getline(cin,sp);
while(t--)
{
string s;
getline(cin,s);
istringstream s1(s);
vector<string>v;
string word;
//cout<<s<<endl;
while(getline(s1,word,' '))
{
v.push_back(word);
// cout<<word<<" "<<t<<endl;
}
//cout<<v[0]<<endl;
stack<string>st;
for(auto j:v)
{
st.push(j);
}
while(!st.empty())
{
cout<<st.top()<<" ";
st.pop();
}
}
return 0;
}
/*
1
my name is khan
khan is name my */