Skip to content

Instantly share code, notes, and snippets.

@cxx
Created December 11, 2009 08:16
Show Gist options
  • Save cxx/254060 to your computer and use it in GitHub Desktop.
Save cxx/254060 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <algorithm>
#include <boost/lexical_cast.hpp>
int main(int argc, char* argv[])
{
int post_id = boost::lexical_cast<int>(argv[1]);
std::string s;
char path_chars[] = "0123456789abcdefghijklmnopqrstuvwxyz";
while (post_id > 0) {
s += path_chars[post_id % 36];
post_id /= 36;
}
std::copy(s.rbegin(), s.rend(), std::ostreambuf_iterator<char>(std::cout));
std::cout << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment