#include <iostream>
#include <string>
#include <regex>
int main() {
std::string input = "Hello??? How are you?? What is your Wi-Fi password????";
std::regex pattern("\\?+"); // Matches one or more consecutive '?'
std::string result = std::regex_replace(input, pattern, "?");
std::cout << result << std::endl;
}
/*
run:
Hello? How are you? What is your Wi-Fi password?
*/