백준
백준 소스코드 [C++] 12605 단어순서 뒤집기
Hani_Levenshtein
2021. 3. 2. 08:32
12605번: 단어순서 뒤집기
스페이스로 띄어쓰기 된 단어들의 리스트가 주어질때, 단어들을 반대 순서로 뒤집어라. 각 라인은 w개의 영단어로 이루어져 있으며, 총 L개의 알파벳을 가진다. 각 행은 알파벳과 스페이스로만
www.acmicpc.net
백준 소스코드 [C++] 12605 단어순서 뒤집기
#include <iostream>
#include <algorithm>
#include <queue>
#include <string.h>
#include <limits.h>
#include <vector>
#include <math.h>
#include <stack>
#include <bitset>
#include <string>
#include <set>
#include <sstream>
#define all(v) v.begin(), v.end()
#define pii pair<int,int>
#define make_unique(v) v.erase(unique(v.begin(), v.end()), v.end())
typedef long long ll;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
string s;
cin >> n;
cin.ignore();
for (int i = 1;i <= n;i++) {
getline(cin, s);
stringstream stream;
stream.str(s);
vector<string> v;
while (stream >> s) v.push_back(s);
cout << "Case #" << i << ": ";
for (int j = v.size() - 1; 0<=j; j--) cout << v[j] << ' ';
cout << '\n';
}
return 0;
}