A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Duplicate Character Counter in Mathematica page! Here, you'll find the source code for this program as well as a description of how the program works.
(* Code *)
(* The inner function does the work, returning the output as a Mathematica list: *)
duplicateCharacterCounter = Function[{s},
Select[
{First[#], Length[#]} & /@ Gather[Characters[s]],
#[[2]] > 1 &]];
(* The outer function performs the output text formatting: *)
duplicateCharacterCounterMain = s \[Function]
Print[#[[1]], ": ", #[[2]]] & /@ duplicateCharacterCounter[s];
(* Valid Tests *)
duplicateCharacterCounterMain /@ {
"goodbyeblues",
"abba",
"aAbB"
};
(* Invalid Tests *)
Duplicate Character Counter in Mathematica was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.