Both problems are solved when I change "<=" to "<": it worked! I don't know why, can someone answer me? Thanks!!!

The first problem
=================

code:

```
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s[30];
    int n = 20;

    for(int i = 0; i < n; i++){
        s[i] = "3";
    }
    sort(s, s + n, [](string a, string b){
        return a <= b;
    });

    return 0;
}

```

error:

```
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

```

The second problem
==================

code:

```
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s[30];
    int n = 20;

    for(int i = 0; i < n; i++){
        s[i] = "3";
    }
    sort(s, s + n, [](const string& a, const string& b){
        return a <= b;
    });

    return 0;
}

```

error:

```
Segmentation fault

```