Algorithm

[C++ 공부] 7. 영어단어 복구

1984 2022. 1. 30. 23:39

 

"it 취업을 위한 알고리즘 문제풀이 (with C, C++)  코딩테스트 대비" 강의 문제 풀이 입니다.

 

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

int main(void)
{
	string str;
	getline(cin, str);

	str.erase(remove(str.begin(), str.end(), ' '), str.end());

	for (auto &item : str)
	{
		if ('A' <= item && item <= 'Z')
		{
			item += 32;
		}
	}
	
	cout << str;

	return 0;
}

 

[참고 자료]

https://hoho325.tistory.com/314

728x90