EDITORIAL for YVNUM (Unofficial)

pls someone tell why i m getting WA, the approach is same as unofficial editorial
i think i m doing mistake in implementing modulo, pls check it once

#include<bits/stdc++.h>

using namespace std;

#define mod 1000000007

typedef long long int ll;

int main()

{
ll ten[100005];

ten[0]=1;

for(ll i=1;i<100005;i++)

ten[i]=(ten[i-1]*10)%mod;

ll t;

cin>>t;

while(t–)

{

char s[100005];

cin>>s;

ll m=0;

ll l;

for(l=0;s[l]!=’\0’;l++);

for(ll i=0;s[i]!=’\0’;i++)

m+= ( (s[i]-48) * ten[l-1-i] )%mod;

ll temp=m;

for(ll i=0;i<l-1;i++)

{

m=( ( (m-(s[i]-48) * ten[l-1]) mod ) * 10 ) mod+(s[i]-48)%mod;

m%=mod;

temp=( ( temp*ten[l])%mod+m)%mod;

}

cout<<temp%mod<<endl;

}

return 0;

}

Yes there are three mistakes in the modulus part

First you forgot the modulus
for(ll i=0;s[i]!=’\0’;i++)
m+= ( (s[i]-48) * ten[l-1-i] )mod; m= mod;

Second
you forgot modulus of the multiplication (s[i]-48) * ten[l-1]) % mod

m=( ( (m-((s[i]-48) * ten[l-1]) % mod + mod ) mod ) * 10 ) mod (s[i]-48)%mod;

Third
you forgot adding modulus value for subtration { (a - b + mod) % mod is correct rather than (a-b)%mod}

(m-((s[i]-48) * ten[l-1]) % mod + mod ) %mod

Submitted your code here
https://www.codechef.com/viewsolution/22104741