7 kyu
Credit Card Mask
79,472 of 196,752samranjbari
Description:
Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct. However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we mask it.
Your task is to write a function maskify
, which changes all but the last four characters into '#'
.
Examples (input --> output):
"4556364607935616" --> "############5616"
"64607935616" --> "#######5616"
"1" --> "1"
"" --> ""
// "What was the name of your first pet?"
"Skippy" --> "##ippy"
"Nananananananananananananananana Batman!" --> "####################################man!"
Strings
Algorithms
Similar Kata:
Stats:
Created | Sep 12, 2014 |
Published | Sep 16, 2014 |
Warriors Trained | 367752 |
Total Skips | 26209 |
Total Code Submissions | 534123 |
Total Times Completed | 196752 |
JavaScript Completions | 79472 |
Haskell Completions | 1808 |
Ruby Completions | 6124 |
C# Completions | 15879 |
Python Completions | 69060 |
CoffeeScript Completions | 176 |
Crystal Completions | 52 |
Java Completions | 20874 |
Rust Completions | 1677 |
Swift Completions | 1150 |
Perl Completions | 79 |
C Completions | 1628 |
D Completions | 14 |
BF Completions | 34 |
Scala Completions | 171 |
TypeScript Completions | 2059 |
Factor Completions | 10 |
COBOL Completions | 10 |
Julia Completions | 20 |
PHP Completions | 195 |
Kotlin Completions | 116 |
Total Stars | 1920 |
% of votes with a positive feedback rating | 90% of 17870 |
Total "Very Satisfied" Votes | 14605 |
Total "Somewhat Satisfied" Votes | 3040 |
Total "Not Satisfied" Votes | 225 |