You should be able to put together an Automator service that would do that, but I think an easier way would be to use text autocorrect. Open System Prefs and in the Keyboard pane go to the Text tab and click the plus at the bottom left then add whatever you want like in my example here.
When I type bbb it autocorrects to what you want by hitting the space bar.