#Java 8, 27 bytes
Java 8, 27 bytes
s->s.replaceAll(".","$0$0")
Old 31 bytes answer before the rules got changed:
s->s.replaceAll("(?s).","$0$0")
NOTE: The suggestion of @EmbodimentOfIgnorance (\n|.
instead of (?s).
has been reverted, since it fails if the input contains \r
. Thanks for reporting to @OlivierGrégoire.
Explanation:
s-> // Method with String as both parameter and return-type
s.replaceAll("(?s).","$0$0") // Regex-replace all matches with the replacement
// And return the changed String as result
Regex explanation:
(?s). // Match:
(?s) // Enable DOTALL mode so newlines and carriage returns
// are treated as literal
. // A single character
$0$0 // Replacement:
$0 // All character(s) found in the match
$0 // And again all character(s) found in the match