Help in writing the program to shorten links in c ++

Hi, I'm a student I have to write to pass a c ++ program that shortens url, something similar to, e.g. tiny.pl functionality: generating a shortcut, verifying whether there is already a shortcut for a given link, returning a link for the indicated shortcut, displaying the full shortcut database. The program is to shorten to 5 characters (0.9 a-z A-Z) e.g. after entering the address www.testetstetste.pl/gole/pl it is to be converted to 0awA5 Do any of you know how to write it? Please help