Codeforces Round #273 Problem E Wavy numbers