I copied this code online. it is about sorting big numbers:
int n;
cin >> n;
vector<string> a(n);
for (int i = 0; i < n; i++) {
    cin >> a[i];
}
std::sort(a.begin(), a.end(), 
    [](const string &left, const string &right)
{
    if (left.size() != right.size()) 
    {
        return left.size() < right.size();
    } 
    else 
    {
        return left < right;
    }
});
for (const string &s : a) {
    cout << s << '\n';
}
Can somebody explain these lines by words:
[](const string &left, const string &right)
and
for (const string &s : a)
I have never encountered the library as well as a for loop like the code used. Thanks!
 
    