#include<cstdio>
using namespace std;
char s[11];
int main()
{
int n=0,a;
scanf("%s",s);
for(a=0;s[a];++a) {
n=2*n+(s[a]==55);
printf("%d ",n);
}
printf("%d\n",n-1+(1<<a));
}
In this code I've found difficulty to understand the line
n=2*n+(s[a]==55);
.
Particularly s[a]==55
.Please tell me how it works?