[IT]/백준

[백준] 11365번 !밀비 급일

working_hard 2019. 6. 10. 16:46
728x90

getline 함수를 알 수 있었던 좋은 코드였습니다. 한줄 읽어서 배열처럼 처리할 수 있습니다.

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

int main() {
	while (1) {
		string s;
		getline(cin, s);
		if (s == "END") {
			break;
		}
		for (int i = s.length()-1; i >=0; i--) {
			cout << s[i];
		}
		cout << endl;
	}

	return 0;
}