// TGif.cc // ECNA 2009 // problem C - Decompressing a GIF #include using namespace std; const int MAX = 1000; string S, OutString; string Dict[MAX]; int Last, NoDigs; // initial input of dictionary void getDict(){ cin>>Last; for(int i=0;i>Dict[i]; } // for debugging void printDict(){ for(int i=0;i>S; //get 1st compression while(S!="0"){ //S == '0'?? icase++; cout << "Case " << icase << ": "; getDict(); if(Last<11) NoDigs=1; //set number of digits else NoDigs=2; pos=0; outString = ""; //get first string and add it to outString n = getNum(pos); Dict[Last] = Dict[n]; outString = outString + Dict[n]; if (Last==10) NoDigs = 2; //special case for 1st num //(will add the 11th item) //now do the rest while(pos>S; //get new compression } return 0; }