思路
李素妍在2020-08-08 17:25:03追加了内容
看代码
#include <iostream>
#include <string>
using namespace std;
int front;
string a[110];
int main(){
string s,b;
int cnt=0;
getline(cin,s);
s=" "+s+" ";
for(int i=1;i<s.size();i++){
if(s[i-1]==' ' && s[i]!=' ') front=i;
if(s[i+1]==' ' && s[i]!=' '){
b=s.substr(front,i-front+1);
for(int j=0;j<b.size();j++)
cout<<b[j];
}
if(s[i]==' ') cout<<s[i];
}
return 0;
}
李素妍在2020-08-08 17:27:53追加了内容
#include <iostream>
#include <string>
using namespace std;
int main(){
string a,b;
int i=0;
while(cin>>a){
i++;
}
for(int j=i-1;j>0;j--){
cout<<a[j];
}
return 0;
}
李素妍在2020-08-08 17:30:40追加了内容
#include <iostream>
#include <string>
using namespace std;
string a[110];
int main(){
int i=0;
while(cin>>a[++i]){
i++;
}
for(int j=i-1;j>0;j--){
cout<<a[j];
}
return 0;
}
再看
李素妍在2020-08-08 17:35:42追加了内容
@宣海宁 我要杀了你
#include <iostream>
#include <string>
using namespace std;
string a[110];
int main(){
int i=0;
while(cin>>a[++i]){
}
for(int j=i;j>1;j--){
cout<<a[j];
}
return 0;
}
李素妍在2020-08-08 17:40:32追加了内容
#include <iostream>
#include <string>
using namespace std;
string a[110];
int main(){
int i=0;
while(cin>>a[++i])
for(int j=i;j>=1;j--){
cout<<a[j];
}
return 0;
}
