#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; bool check3(string s){ int n=s.length(); if(n==0) return true; rep(i,n) for(int j=i+1;j>s; for(char c='1';c<='9';c++){ if(count(s.begin(),s.end(),c)<4){ string t=s+c; sort(t.begin(),t.end()); if(check(t)) printf("%c\n",c); } } return 0; }