#PCBBAY0000020. Dấu phân cách hàng nghìn cho số nguyên (Thousands Separators for Integers)
Dấu phân cách hàng nghìn cho số nguyên (Thousands Separators for Integers)
Thousands Separators for Integers
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer that may be negative or zero, format its decimal representation with comma separators every three digits, counting from the right. Do not insert a separator at either end; a negative sign precedes the first group.
Input
The only line contains an integer .
Output
Print the integer with commas separating groups of three digits.
Subtasks
- Subtask 1 (100 points): .
Examples
Example 1
Input
1234567
Output
1,234,567
Explanation. Group the digits of 1234567 in threes from the right, retaining a negative sign if present. The result is 1,234,567.
Example 2
Input
0
Output
0
Explanation. Group the digits of 0 in threes from the right, retaining a negative sign if present. The result is 0.
Example 3
Input
-987654321
Output
-987,654,321
Explanation. Group the digits of -987654321 in threes from the right, retaining a negative sign if present. The result is -987,654,321.