/ OPS / 题库 /

Number Format

Number Format

#描述#
You are a developer for a financial computer system. Users of the system often operate with large numbers, so it's important that numbers be formatted in an easy-to-read manner. You are given a number containing the internal representation of a non-negative number. This number will contain only digits, along with an optional decimal separator represented by a comma (','). Format the number as follows:
1. If the number contains a decimal separator, replace the decimal separator with a period ('.').
2. Divide the integer part of the number into groups of three consecutive digits, from right to left. Depending on the number of digits, the left-most group might contain 1 or 2 or 3 digits. Insert a single space (' ') between each pair of consecutive groups. (The integer part of the number is the part of the number to the left of the decimal separator if one exists, or the entire number if there is no decimal separator.)
For example, "1234567,890" would be formatted as "1 234 567.89" and "1024" would be formatted as "1 024". If insignificant leading or trailing zeroes exist in the number, they must be deleted. For example, "00003,000000" would be formatted "3".

#格式#
##输入格式##
The input contains multiple test cases. For each test case, it only contains a large number (up to 1000 digits).

##输出格式##
Output the formatted version of the given number.

#样例1#
##样例输入1##

1234567,890
1024
00003,1234000

##样例输出1##

1 234 567.89
1 024
3.1234

#限制#
1000ms
32768KB

#提示#

#来源#
cryboy

信息

ID
1443
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者