#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=12;
string a,b;
bool get(int x,int w)
{
	if(!x)return 0;
	string sn=to_string(x);
	for(int i=0;i<=w-sn.size();i++)
		sn="0"+sn;
	for(int i=0;i<w;i++)
		if(abs(sn[i]-sn[i-1])<2)return 0;
	cout<<sn<<" ";
	return 1;
}
signed main()
{
	while(cin>>a>>b)
	{
		int ans=0;
		for(int i=stoi(a);i<=stoi(b);i++)
		{
			bool F=get(i,b.size());
			ans+=F;
//			if(F)
//				cout<<i<<",";
		}
		cout<<"\n"<<ans<<"\n\n";
	}
	return 0;
}

0 comments

No comments so far...

Information

ID
167
Time
1000ms
Memory
256MiB
Difficulty
9
Tags
# Submissions
41
Accepted
5
Uploaded By