Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <string>
- using namespace std;
- int main()
- {
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- int start_count{}, end_count{}, inside{};
- char temp{};
- string text{}, result{};
- int i{};
- cout << "Введіть будь-який текст: " << endl;
- getline(cin, text);
- for (i = 0; i < text.size(); i++) {
- if (text[i] == '<') {
- start_count++;
- temp = text[i];
- }
- else if (text[i] == '>') {
- end_count++;
- temp = text[i];
- }
- }
- if (start_count != end_count || temp != '>') {
- for (i = 0; i < text.size(); i++) {
- cout << text[i];
- }
- return 0;
- }
- for (i = 0; i < text.size(); i++) {
- if (text[i] == '<') {
- inside = 1;
- }
- if (inside == 0) {
- result += text[i];
- }
- if (text[i] == '>') {
- inside = 0;
- }
- }
- for (i = 0; i < result.size(); i++) {
- cout << result[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement