// Saint Bonaventure University Programming Contest // February 15, 2008 // Problem #7 - Data Compression // Team Name: SOLUTION #include using namespace std; #include "apstring.h" int main(void) { apstring conversion = "123456789ABCDEF"; apstring input; cin >> input; apstring answer = ""; int pos = 0; while (pos < input.length()) { char c = input[pos]; int count = 1; pos++; while (pos < input.length() && input[pos]==c) { count++; pos++; } answer += c; answer += conversion[count-1]; } cout << answer << endl; return EXIT_SUCCESS; }