#include <stdio.h>
#include <string.h>
char num[1000001];
int total[1000000]={0};
int main() {
int cnt=0;
scanf("%s",num);
int len=strlen(num);
int two=0;
int n=0;
for(int i=len-1; i>=0; i--) {
int x=num[i]-'0';
if(two==0) {
total[cnt]+=x;
two++;
} else if(two==1) {
total[cnt]+=2*x;
two++;
} else if (two==2){
total[cnt]+=4*x;
if(i>0) {
two=0;
cnt++;
}
}
}
for(int i=cnt;i>=0; i--) {
printf("%d",total[i]);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: