~cpp #include <iostream> using namespace std; const MAX_STRING_SIZE=255; void print_munja(char* input_string) { cout << input_string << "\n"; } void print_munja(char* input_string, int maxs) { for (register int i=0; i<maxs; ++i) cout << input_string << "\n"; } void main() { char temp[MAX_STRING_SIZE], temp_sub[MAX_STRING_SIZE]; for (int i=0; ; ++i) { int check_number=0; cin.getline(temp,MAX_STRING_SIZE); for (register int k=strlen(temp)-1; k>=0; --k) { if (' '==temp[k]) { strcpy(temp_sub,&temp[k+1]); temp[k]=0; check_number=-1; } else if ('0'>temp[k] || temp[k]>'9') break; } if (-1==check_number) { if (0==strcmp(temp_sub,"0")) break; print_munja(temp,i+1); } else print_munja(temp); } }