String-difference problem

all test case not passed:https://ide.codingblocks.com/s/218557

@souravkhan654 no need to print the middle characters again and again.

cout<<ans;
for(int i=1;i<strlen(a);i++)
	{ 
		
	    int y=a[i];
	    int x=y-ans;
			cout<<x<<a[i];
	      ans=a[i];
	  }

if this resolves your doubt mark it as resolved.