#include #include //i'm flattered by the fact that i'll receive full feedback on this. warms my heart, i tell you // : " ) <-- me blushing int main(){ std::stringstream result; int totalNumbers=0, aNumber=0, anotherOne=0; std::cin >> totalNumbers; for(int counter = 0; counter < totalNumbers; counter++){ std::cin >> aNumber; if(aNumber - anotherOne > 1) result<< anotherOne+1 << "-" << aNumber-1<< "\n"; anotherOne = aNumber; } if(anotherOne <= 99) result << anotherOne + 1 << "-100"; //the rare doublehack in full effect std::cout << result.str(); }