Baekjoon 11656
접미사 배열


QUESTION ❔



CODE ⌨️

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

vector<string> vec;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	string s;
	getline(cin, s);

	for (int i = 0; i < s.length(); i++)
	{
		string temp = s.substr(i, s.length());

		vec.push_back(temp);
	}

	sort(vec.begin(), vec.end(), less<string>());

	for (int i = 0; i < vec.size(); i++)
	{
		cout << vec[i] << "\n";
	}

	return 0;
}



RESULT 💛



SIMPLE DISCUSSION ✏️

문자열 관련 문제였다. substr(), sort(greater, less) 복습을 할 수 있었다.



SOURCE 💎

Baekjoon_Link 👈 Click here


*****
NOT A TALENT ❎ NOT GIVING UP ✅
CopyRight ⓒ 2022 DCherish All Rights Reserved.