A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Duplicate Character Counter page! Here, you’ll find a description of the project as well as a list of sample programs written in various languages.
Although a one line solution for this problem is feasible, just as huge brute force solutions are, we should avoid both of these approaches. Instead, our goal should be to find a fine line between both, where the code is not bogged down but is largely readable and maintainable.
The code should return the count of all duplicate, case-sensitive, alphanumeric characters, that occur more than once in the given string. Characters should also be presented in the order in which they appear in the string. For instance, ‘abba’ should output ‘a’ as the first character that has a duplicate.
Description | Input | Output |
---|---|---|
No Input | Usage: please provide a string | |
Empty Input | ”” | Usage: please provide a string |
Basic String | “goodbyeblues” | o: 2 b: 2 e: 2 |
Correct Order | “abba” | a: 2 b: 2 |
Case Distinct | “aAbB” | No duplicate characters |