#include #include using namespace std; const int MAX = 1000; struct person { string name; int initpos; } list[MAX]; int main() { int n, icase=0; cin >> n; while (n > 0) { icase++; for(int i=0; i> list[i].name; list[i].initpos = i; } for(int i=1; i 0 && list[j-1].name > val.name) { list[j] = list[j-1]; j--; } list[j] = val; } int sum = list[0].initpos; for(int i=1; i> n; } }