- 字符串删除连续空格,只保留一个
#include <iostream>
#include <string>
using namespace std;
int main(){
string str1;
char str2[100];
cout << "请输入一个字符串:";
getline(cin, str1);//如果输入有空格的字符串,用getline
int len = str1.size();//字符串的长度
int j = 0;
str2[