http://www.spoj.com/problems/DCRYPT/