#CCBCHBON0000043. Chỉ in chữ số trước dấu chấm (Print Digits Before First Period)
Chỉ in chữ số trước dấu chấm (Print Digits Before First Period)
Print Digits Before First Period
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read until the first period .. Print only ASCII digits 0 through 9 occurring before that period, concatenated in their original order, then print exactly one LF. Ignore the period and the entire suffix. If there is no preceding digit, print only LF.
Input
An ASCII stream of 1..100000 bytes containing at least one period; it may contain LF, spaces, and other characters.
Output
Digits before the first period, including any leading zeroes, followed by LF.
Subtasks
-
Subtask 1 (20%): 1..30 ASCII bytes, at least one period.
-
Subtask 2 (30%): 1..1000 ASCII bytes, at least one period.
-
Subtask 3 (50%): 1..100000 ASCII bytes, at least one period.
Examples
Example 1
Input:
A0b12.9Z
Output:
012
Explanation:
Read to first period; retain only preceding digit characters in their original order. Exact input: "A0b12.9Z"; exact output: "012\n".
Example 2
Input:
abc.123
Output:
Explanation:
Read to first period; retain only preceding digit characters in their original order. Exact input: "abc.123"; exact output: "\n".
Example 3
Input:
.987
Output:
Explanation:
Read to first period; retain only preceding digit characters in their original order. Exact input: ".987"; exact output: "\n".
Example 4
Input:
1
2.34
Output:
12
Explanation:
Read to first period; retain only preceding digit characters in their original order. Exact input: "1\n2.34"; exact output: "12\n".
Note on displayed bytes: \n denotes an actual LF, \t an actual tab and \r an actual CR. The JSON-style Input renderings in explanations are diagnostic only, not extra input characters.