알고리즘

[C++] 백준 11365번 !밀비 급일

J3SUNG 2019. 9. 9. 08:26
728x90

문자를 뒤집는 문제입니다.

줄단위로 받기위해서
getline(cin, string)을 사용하고
reverse함수를 사용해서 문자를 뒤집었습니다.

 

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

int main(int argc, char *argv[])
{
	string s;

	while (1) {
		getline(cin, s);
		if (s == "END") {
			break;
		}
		reverse(s.begin(), s.end());
		cout << s << endl;
	}

	return 0;
}