#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
string randstr()
{ int n = random() % 12 + 8;
string r;
for (int i = 0; i < n; i += 1)
r += (char)(random() % 26 + 'a');
return r; }
void print(string arr[], int num)
{ for (int i = 0; i < num; i += 1)
cout << arr[i] << " ";
cout << "\n"; }
void sort(string A[], int N)
{ int stop = N - 1;
while (stop > 0)
{ int maxpos = 0;
string maxstr = A[maxpos];
for (int i = 1; i <= stop; i += 1)
if (A[i] > maxstr)
{ maxstr = A[i];
maxpos = i; }
A[maxpos] = A[stop];
A[stop] = maxstr;
stop -= 1; } }
int main(int argc, char * argv[])
{ int num = 1024;
if (argc > 1)
{ char * c;
num = strtol(argv[1], & c, 10);
if (* c != '\0')
{ cerr << "'" << argv[1] << "' is not a proper number\n";
exit(1); } }
string * arr = new string[num];
srandomdev();
for (int i = 0; i < num; i += 1)
arr[i] = randstr();