#include using namespace std; int results[9216]; // max possible results int nr; void operatorOrder(int [], int); void operandOrder(int a[], int n) { if (n == 1) { results[nr++] = a[0]; } else { for(int i=0; i0 && a[j-1]>sav) { a[j] = a[j-1]; j--; } a[j] = sav; } } void output(int a[], int nr) { int maxCount=0, saveFirst, saveLast; int count = 1; int first = a[0]; for(int i=1; i 1) { if (count >= maxCount) { maxCount = count; saveFirst = first; saveLast = a[i-1]; } first = a[i]; count = 1; } } if (count >= maxCount) { maxCount = count; saveFirst = first; saveLast = a[nr-1]; } cout << saveFirst << " to " << saveLast << endl; } int main() { int vals[4]; int icase=0; cin >> vals[0] >> vals[1] >> vals[2] >> vals[3]; while (vals[0] != 0) { icase++; cout << "Case " << icase << ": "; nr=0; operandOrder(vals, 4); sort(results, nr); output(results, nr); cin >> vals[0] >> vals[1] >> vals[2] >> vals[3]; } }