#K37557. Maskify the String
Maskify the String
Maskify the String
Given a string s, your task is to mask all characters except the last four characters. In other words, if |s| > 4, replace the first |s| - 4 characters with the '#' symbol and keep the last four characters unchanged. If |s| ≤ 4, simply return the string as-is.
For example, if s = "4556364607935616"
, the output should be "############5616"
.
You need to read the input from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The input consists of a single line containing the string s. The string may contain numbers, letters, and special characters. If s has a length of at most 4, output it unchanged.
Note: For mathematical notation, if |s| denotes the length of the string, then the replacement should be applied only if |s| > 4.
outputFormat
Output the masked version of the input string on a single line. If the length of the string is greater than 4, all characters except the last four should be replaced with the '#' symbol. Otherwise, output the string unchanged.
## sample4556364607935616
############5616