string ans; ans.reserve(m + n);//调整string大小,使之可以容纳m+n个元素 /*对于vector ,可以使用reserve,也可以直接: vector<int> abc(10); //初始化了10个默认值为0的元素*/