littleqwq @ 2023-08-24 15:26:39
#include <bits/stdc++.h>
using namespace std;
int p=0,o=0,x,y;
int main() {
string s;
cin >> s;
s[s.size()]=',';
for(int i=0;i<s.size();i++){
int y=i-1;
if(s[i]==','){
bool f=true;
int cnt=0;
for(int j=x;j<=y;j++){
if((s[j]>='a'&&s[j]<='z')||(s[j]>='A'&&s[j]<='Z')||(s[j]>='0'&&s[j]<='9')||(s[j]=='!'||s[j]=='@'||s[j]=='#'||s[j]=='$')){
cnt++;
f=true;
}else{
f=false;
}
}
if(f){
for(int j=x;j<=y;j++){
cout<<s[i];
}
cout<<endl;
}//移动到一道新左边
x++;
x++;
x+=y;
}
}
return 0;
}
by __Harry_Haiyun__ @ 2023-08-24 16:52:20
@wangzihan1026 请问您判断字符串长短的语句在哪里呢?
by littleqwq @ 2023-08-24 17:16:10
@__Harry_Haiyun__ 我AC了
by __Harry_Haiyun__ @ 2023-08-24 18:05:13
@wangzihan1026 那您的代码是怎么改的呢