#include <iostream>
#include <memory>
using namespace std;
int main()
{
const int SIZE = 10;
// unique_ptr<char[]> noRepeats(new char);
char originalArray[SIZE];
originalArray [0] = 'a';
originalArray [1] = 'b';
originalArray [2] = 'b';
originalArray [3] = 'c';
originalArray [4] = 'a';
originalArray [5] = 'c';
originalArray [6] = 'a';
originalArray [7] = 'c';
originalArray [8] = 'b';
originalArray [9] = 'c';
cout << "This is the original array:" << endl;
for (int i = 0; i < SIZE; i++)
{
cout << originalArray[i] << endl;
}
cout << "Now the program will run a for loop to identify dupes" << endl;
for (int j = 1; j <= SIZE - 1; j++)
{
for (int k = j; k <= SIZE; k++)
{
if (originalArray[j] > originalArray[k])
{
swap(originalArray[j],originalArray[k]);
}
}
}
cout << "This is the sorted array:" << endl;
for (int i = 0; i < SIZE; i++)
{
cout << originalArray[i] << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5PgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogIGNvbnN0IGludCBTSVpFID0gMTA7Ci8vICB1bmlxdWVfcHRyPGNoYXJbXT4gbm9SZXBlYXRzKG5ldyBjaGFyKTsKICBjaGFyIG9yaWdpbmFsQXJyYXlbU0laRV07CiAgb3JpZ2luYWxBcnJheSBbMF0gPSAnYSc7CiAgb3JpZ2luYWxBcnJheSBbMV0gPSAnYic7CiAgb3JpZ2luYWxBcnJheSBbMl0gPSAnYic7CiAgb3JpZ2luYWxBcnJheSBbM10gPSAnYyc7CiAgb3JpZ2luYWxBcnJheSBbNF0gPSAnYSc7CiAgb3JpZ2luYWxBcnJheSBbNV0gPSAnYyc7CiAgb3JpZ2luYWxBcnJheSBbNl0gPSAnYSc7CiAgb3JpZ2luYWxBcnJheSBbN10gPSAnYyc7CiAgb3JpZ2luYWxBcnJheSBbOF0gPSAnYic7CiAgb3JpZ2luYWxBcnJheSBbOV0gPSAnYyc7CgogIGNvdXQgPDwgIlRoaXMgaXMgdG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