Basic masking
Input
mask_all_but_last4('1234567890')
Output
'******7890'
Input length 10 -> first 6 characters masked, final 4 kept.
Full lesson preview
Replace all characters in a string with a mask character except for the final four characters.
Problem statement
Task
Examples
Input
mask_all_but_last4('1234567890')
Output
'******7890'
Input length 10 -> first 6 characters masked, final 4 kept.
Input format
Output format
Constraints
Samples
Input
mask_all_but_last4('abcd')
Output
'abcd'
Strings of length 4 are returned unchanged.