S
S
Sam Suhomlin2020-05-18 11:28:00
C++ / C#
Sam Suhomlin, 2020-05-18 11:28:00

How to remove characters in a string that are in pairs?

Hello everyone, I need a hello)
Task: there is a string "abvgd" - from it you need to remove the lines that stand in a double place. Tobish should get "abvgd" -> "avd".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timur Pokrovsky, 2020-05-18
@Makaroshka007

string abcde = "abcde";

for (int i = 1; i < abcde.length(); i++) {
    abcde.erase(i, 1);
}

cout << abcde << endl;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question