题解分享
题解分享简介
拓拓在打字 - 题解
```C++
#include<bits/stdc++.h>
using namespace std;
int main(){
string s=" ";
getline(cin,s);
for(int i=0;i<s.size();i++){
if(s[i]==' '&&s[i+1]==' ') continue;
cout<<s[i];
}
return 0;
}
```
0
0
1
17
拓拓在打字 - 题解
```
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int main(){
string str;
while(cin>>str){
cout<<str<<' ';
}
}
```
0
0
2
21
拓拓在打字 - 题解
只要不是连续空格就输出
```
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
string str;
getline(cin,str);
for(int i=0;i<str.length();i++)
{
if(!(str[i]==' '&&str[i+1]==' '))
cout<<str[i]; }
return 0;
}
```
查看全文
0
0
1
9
拓拓在打字 - 题解
include
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string s;
string c;
getline(cin,s);
for(int i=0;i
0&&i<=s.length()-2)
{
if(s[i] ==' '&&s[i+1]==' ')
{
continue;
}
else
c.push_back(s[i]);
}
}
cout<<c<<"\n";
return 0;
}
查看全文
0
0
0
9
拓拓在打字 - 题解
include
include
using namespace std;
int main()
{
string str;
while (cin >> str) {
cout << str << ' ';
}
//直接输入字符串,然后打印每一个字符串,且后面跟一个空格
return 0;
}
0
0
0
7
拓拓在打字 - 题解
include
using namespace std;
int main()
{
string n;
string a[12];
int i=0;
while(cin>>n)
{
a[i]=n;
i+=2;
}
for(int i=0;i<12;i++)
{
if(i%2==0)
{
cout<<a[i];
}
else
cout<<" ";
}
```
return 0;
```
}
// 0 1 2 3 4 5 6 7 8 9 10 11
查看全文
0
0
0
7
拓拓在打字 - 题解
```
#include <iostream>
#include<stdio.h>
#include <vector>
#include <string>
using namespace std;
int main() {
string str;
while (cin >> str)
cout << str << ' ';
return 0;
}
```
0
0
0
7
拓拓在打字 - 题解
```
#include <iostream>
#include<stdio.h>
#include <vector>
#include <string>
using namespace std;
int main() {
string str;
getline(cin, str);
int n = str.size();
for (int i = 0; i < n; i++) {
if (str[i] != ' ' || (str[i] == ' ' && str[i + 1] != ' '))
cout << str[i];
}
return 0;
}
```
查看全文
0
0
0
7
拓拓在打字 - 题解
```
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
getline(cin,s);
for(int i = 0;i < s.size();i++)
{
if((s[i] != ' ')||(s[i] == ' '&& s[i+1] != ' '))
cout << s[i];
}
return 0;
}
```
查看全文
0
0
0
9
拓拓在打字 - 题解
include
using namespace std;
int main(){
int n=0;
string s;
getline(cin,s);
n=s.size();
for(int i=0;i<n;i++){
if(s[i]==' '&&s[i+1]==' ') ;
else cout <<s[i];
}
return 0;
}
0
0
0
8



