Return an object that maps each character occurring more than once in str to the number of times it occurs. Characters that occur only once are left out.
Example 1
Input
str = "programming"
Output
{ r: 2, g: 2, m: 2 }
Explanation
r, g and m each occur twice. Every other letter occurs once.
Example 2
Input
str = "hello"
Output
{ l: 2 }
Explanation
only l repeats.
Example 3
Input
str = "xyz"
Output
{}
Explanation
no character repeats, so the result is empty.
Tab indents. Press Esc, then Tab to leave the editor.
Ctrl or ⌘ + Enter runs the tests.
Run your code to see every test here. Nothing is submitted or recorded.