#include <iostream>
using namespace std;
int main() {
string front;
string back;
string name;
int number;
cout << "How many names will u enter ?\n";
cin >> number;
cout << "Enter the names\n";
cin >> name;
front = name;
back = name ;
for (int i = 1 ; i < number ; i++)
{
cin >> name;
if ( name < front)
{
front = name;
}
else if ( name > back )
{
back = name;
}
}
cout << "front is " << front << endl;
cout << "back is " << back << endl;
return 0;
}
CiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoJc3RyaW5nIGZyb250OwoJc3RyaW5nIGJhY2s7CglzdHJpbmcgbmFtZTsKCWludCBudW1iZXI7CgkKCWNvdXQgPDwgIkhvdyBtYW55IG5hbWVzIHdpbGwgdSBlbnRlciA/XG4iOwoJY2luID4+IG51bWJlcjsKCgljb3V0IDw8ICJFbnRlciB0aGUgbmFtZXNcbiI7CgljaW4gPj4gbmFtZTsKCQoJZnJvbnQgPSBuYW1lOwoJYmFjayA9IG5hbWUgOwoJCglmb3IgKGludCBpID0gMSA7IGkgPCBudW1iZXIgOyBpKyspCgl7CgkJY2luID4+IG5hbWU7CgkJCgkKCQlpZiAoIG5hbWUgPCBmcm9udCkKCQl7CgkJCWZyb250ID0gbmFtZTsKCQkJCgkJfQoJCWVsc2UgaWYgKCBuYW1lID4gYmFjayApCgkJewoJCQliYWNrID0gbmFtZTsKCQkJCgkJfQoJCQoJfQoJCgljb3V0IDw8ICJmcm9udCBpcyAiIDw8IGZyb250IDw8IGVuZGw7Cgljb3V0IDw8ICJiYWNrIGlzICIgPDwgYmFjayA8PCBlbmRsOwoKCXJldHVybiAwOwp9