Odd leonardo keyboard problem

When I run your code I get lower case ds. Therefore there is nothing wrong with your code.

Your error lies not with your arduino but with the system you are feeding your arduino into.
Can you describe what you are doing. Operating system, other keyboards, application at the computer end.