첫주차라 난이도가 어렵지 않았고 c++ STL sort와 정렬 기준에 맞는 compare함수를 별도로 구현하여 문제를 해결했다.

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

int n, k;

bool compare(string a, string b) {
	if (a.length() == b.length()) return a < b;
	return a.length() < b.length();
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	vector<string> words(n);
	for (int i = 0; i < n; i++) cin >> words[i];
	sort(words.begin(), words.end(), compare);
	cout << words[k-1];
	return 0;
}