Hello, this is my code:
#include <iostream>
#include <string.h>
using namespace std;
int main()
{ ios_base::sync_with_stdio(false);
string s,t,n;
int s1=0,t1=0,n1=0;
cin>>s;
cin>>t;
for(int i=0;i<s.length();i++)
{
n[i]=((int)s[i]+(int)t[i])/2;
}
for(int i=0;i<s.length();i++)
{
s1+=(int)s[i];
t1+=(int)t[i];
n1+=(int)n[i];
}
if((n1>s1)&&(n1<t1))
{
for(int y=0;y<s.length();y++)
cout<<n[y];
}
else
cout<<"No such string";
return 0;
}
This code runs successfully on Codeblocks & Codechef IDE but when I submit this on Codeforces (GNU G++11 4.9.2) I get runtime error on sample test 3 (abcdefg,abcdefh)
Please suggest me how to fix this error.