#K91802. Replace Digits with Asterisk
Replace Digits with Asterisk
Replace Digits with Asterisk
You are given a string s
. Your task is to remove all contiguous sequences of digits (i.e., characters between 0
and 9
), and replace each such sequence with a single asterisk character *
. In other words, every maximal substring that matches the regular expression $\d+$
should be replaced by *
.
For example, the input a123b456c789
should be transformed into a*b*c*
.
Note that the input string may contain uppercase and lowercase letters along with digits, and its length is in the range 1 ≤ |s| ≤ 1000.
inputFormat
The input consists of a single line containing a non-empty string s
(1 ≤ |s| ≤ 1000). The string may include digits and alphabetical characters.
outputFormat
Output a single line containing the resulting string after replacing every maximal sequence of digits with a single asterisk *
.
abcdef
abcdef