荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: huhaiming (一生只爱她), 信区: Program
标  题: Scramble Sort(英文原题)
发信站: 荔园晨风BBS站 (Thu May 29 18:43:16 2003), 站内信件


Scramble Sort

Time limit: 1 Seconds   Memory limit: 32768K

Background

In this problem you will be given a series of lists containing both
words and numbers. The goal is to sort these lists in such a way that
all words are in alphabetical order and all numbers are in numerical
order. Furthermore, if the nth element in the list is a number it must
remain a number, and if it is a word it must remain a word.

Input

The input will contain multiple lists, one per line. Each element of the
 list will be separated by a comma followed a space, and the list will
be terminated by a period. The input will be terminated by a line
containing only a single
period.

Output

For each list in the input, output the scramble sorted list,
separating each element of the list with a comma followed by a space,
and ending the list with a period.

Sample Input

0.
banana, strawberry, OrAnGe.
Banana, StRaWbErRy, orange.
10, 8, 6, 4, 2, 0.
x, 30, -20, z, 1000, 1, Y.
50, 7, kitten, puppy, 2, orangutan, 52, -100, bird, worm, 7, beetle.
.

Sample Output

0.
banana, OrAnGe, strawberry.
Banana, orange, StRaWbErRy.
0, 2, 4, 6, 8, 10.
x, -20, 1, Y, 30, 1000, z.
-100, 2, beetle, bird, 7, kitten, 7, 50, orangutan, puppy, 52, worm.


--

菩提本无树,明镜亦非台

本来无一物,何处惹尘埃

※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.200]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店