#include "stdafx.h" #define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; char * newstr(char * temp){ int i = 0, j = 0, N; N = strlen(temp) + 1; char *str = new char[N]; strcpy(str, temp); char* fin_string = new char[N]; while (i != N) { if (str[i] != '<') { fin_string[j] = str[i]; i++; j++; } else { fin_string[j] = str[i]; i++; j++; while (str[i] != '>') i++; fin_string[j] = str[i]; i++; j++; } } return fin_string; delete[]str; } int main() { if (strcmp(newstr("Viktoria"), "Victoria") || strcmp(newstr(""), "") || strcmp(newstr(""), "<>") || strcmp(newstr("<>"), "<<>>")) { cout << "bad" << endl; return 1; } cout << "Input string" << endl; char * temp = new char[256]; gets(temp); char * fin_string = newstr(temp); cout << "Well done, fine human. Your new string is down here: " << endl << fin_string << endl; delete[]fin_string; return 0; }