#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string str, remainder;
while(true){
getline(cin, str);
if(str.compare("END") == 0)
break;
reverse(str.begin(), str.end());
cout << str << endl;
}
return 0;
}
오 씨쁠쁠도 문자열 비교 가능하다
str == "END"
이렇게 쓸 수 있음
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
string str, remainder;
while(true){
getline(cin, str);
if(str == "END")
break;
reverse(str.begin(), str.end());
cout << str << endl;
}
return 0;
}
'백준' 카테고리의 다른 글
2851 슈퍼마리오 (0) | 2019.10.25 |
---|---|
2460 지능형기자 2 (0) | 2019.10.25 |
2864 5와 6의 차이 (0) | 2019.10.25 |
1158 조세퍼스 문제 (0) | 2019.10.13 |
1193 분수찾기 (0) | 2019.10.13 |