Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
99500 | 李大川LDC | 单词排序 | C++ | 解答错误 | 0 | 0 MS | 268 KB | 439 | 2023-08-22 22:05:32 |
using namespace std; bool cmp(string x,string y) { return x<y; } string a[105]; int main() { string s; getline(cin,s); int b=0; int x=0; for(int i=0;i<s.size();i++) { if(s[i]==','||s[i]==' '||s[i]=='.'||s[i]=='!') { a[b++]=s.substr(x,i-x); x=i+1; } } sort(a,a+b,cmp); for(int i=0;i<b;i++) { cout<<a[i]<<"\n"; } return 0; }
hi,I am Jack!
I
Jack
am
hi
4
I
Jack
am
hi
exit code: 0, checker exit code: 0
hello,My name is jack.
My
hello
is
jack
name
5
My
hello
is
jack
name
exit code: 0, checker exit code: 0
The first step is as good as half over.
The
as
as
first
good
half
is
over
step
9
The
as
as
first
good
half
is
over
step
exit code: 0, checker exit code: 0
Do one thing at a time,and do well.
Do
a
and
at
do
one
thing
time
well
9
Do
a
and
at
do
one
thing
time
well
exit code: 0, checker exit code: 0
Knowlegde can change your fate and English can accomplish your future.
English
Knowlegde
accomplish
and
can
can
change
fate
future
your
your
11
English
Knowlegde
accomplish
and
can
can
change
fate
future
your
your
exit code: 0, checker exit code: 0