#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
enum Task
{ PRINT, COLLECT };
/***shared memory***/
vector < string > recenice;
string recenica;
/**********************/
void job(Task task)
{
for (unsigned int i = 0; i < 5; i++)
{
if (task == PRINT)
{
cout << i << ". " << recenice[i] << endl;
}
else if(task == COLLECT)
{
getline(cin, recenica);
recenice.push_back(recenica);
}
}
}
struct Sorter
{
bool operator() (string s0, string s1)
{
return s0.size() < s1.size();
}
}
sorter;
int main()
{
cout << "unesi 5 recenica\n";
job(COLLECT);
sort(recenice.begin(), recenice.end(), sorter);
job(PRINT);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmVudW0gVGFzawp7IFBSSU5ULCBDT0xMRUNUIH07CgovKioqc2hhcmVkIG1lbW9yeSoqKi8KdmVjdG9yIDwgc3RyaW5nID4gcmVjZW5pY2U7CnN0cmluZyByZWNlbmljYTsKLyoqKioqKioqKioqKioqKioqKioqKiovCgp2b2lkIGpvYihUYXNrIHRhc2spCnsKICBmb3IgKHVuc2lnbmVkIGludCBpID0gMDsgaSA8IDU7IGkrKykKICB7CglpZiAodGFzayA9PSBQUklOVCkKIAl7CgkgIGNvdXQgPDwgaSA8PCAiLiAiIDw8IHJlY2VuaWNlW2ldIDw8IGVuZGw7Cgl9CgllbHNlIGlmKHRhc2sgPT0gQ09MTEVDVCkKCXsKCSAgZ2V0bGluZShjaW4sIHJlY2VuaWNhKTsKCSAgcmVjZW5pY2UucHVzaF9iYWNrKHJlY2VuaWNhKTsKCX0KCiAgfQp9CgpzdHJ1Y3QgU29ydGVyCnsKICBib29sIG9wZXJhdG9yKCkgKHN0cmluZyBzMCwgc3RyaW5nIHMxKQogIHsKICAgIHJldHVybiBzMC5zaXplKCkgPCBzMS5zaXplKCk7CiAgfQp9CnNvcnRlcjsKCgoKaW50IG1haW4oKQp7CiAgY291dCA8PCAidW5lc2kgNSByZWNlbmljYVxuIjsKCiAgam9iKENPTExFQ1QpOwogIHNvcnQocmVjZW5pY2UuYmVnaW4oKSwgcmVjZW5pY2UuZW5kKCksIHNvcnRlcik7CiAgam9iKFBSSU5UKTsKCgogIHJldHVybiAwOwp9