Răspuns :
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("rotund.in");
ofstream g("rotund.out");
int n, i, num, contor;
int r[51], c[11], d[11];
bool rotund(int m)
{
int copie=m, gasit=0, j, nrcif=0, k=0, t;
if (m<10) gasit=0;
else
{
while (copie)
{
++nrcif;
c[nrcif]=copie%10;
copie=copie/10;
}
for (j=1; j<=nrcif/2; ++j) { swap(c[j],c[nrcif+1-j]);}
for (j=1; j<=nrcif; ++j) { d[j]=c[j]; }
while (gasit==0 && k+1<nrcif)
{
t=d[nrcif];
for (j=nrcif; j>1; --j) { d[j]=d[j-1];}
d[j]=t; ++k;
gasit=1;
for (j=1; j<=nrcif; ++j)
if (c[j]!=d[j]) { gasit=0; break; }
}
}
if (gasit) return true;
else return false;
}
int main()
{
f >> n;
for (i=1; i<=n; ++i)
{
f >> num;
if (rotund(num))
{
++contor;
r[contor]=num;
}
}
g << contor << "\n";
if (contor)
for (i=1; i<=contor; ++i)
g << r[i] << " ";
}