#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


void delete_chars_between(std::string& line, char del)
{
    std::string::iterator itr_from = std::find(line.begin(), line.end(), del);
    // I don't want to pass an iterator to two past the last element
    if ( itr_from == line.end() )
    	return;	
    std::string::iterator itr_to = std::find(itr_from + 1, line.end(), del);
    //                                               ^^^^

    while ( itr_to != line.end() )
    {
    	itr_to = line.erase(itr_from + 1, itr_to);

    	itr_from = std::find(itr_to + 1, line.end(), del);
		// to start another couple ^^^^
    	if (itr_from == line.end())
        	break;

    	itr_to = std::find(itr_from + 1, line.end(), del);
    }
}

int main() {
	std::vector<std::pair<std::string, char>> test{
		{ "hah haaah hah hello!", 'h' },
		{ "hah haaah hah hello!", 'r' },
		{ "hah haaah hah hello!", 'e' },
		{ "hah haaah hah hello!", 'a' }
	};

	for ( auto & t : test ) {
		std::cout << "\noriginal: \t" << t.first << "\ndeleting \'" << t.second;
		delete_chars_between(t.first, t.second);
		std::cout << "\': \t" << t.first << '\n';
	}
	
	return 0;
}