3
unordered_map<string, string> hash;4
string server = "http://tinyurl.com/";5
string all = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";8
// Encodes a URL to a shortened URL.9
string encode(string longUrl) {12
int ran = rand() % 10;13
int strsize = all.size();15
int index = rand() % strsize;20
hash[(server + add)] = longUrl;22
return (server + add);25
// Decodes a shortened URL to its original URL.26
string decode(string shortUrl) {27
return hash[shortUrl];31
// Your Solution object will be instantiated and called as such:33
// solution.decode(solution.encode(url));