Why it is only taking inputs and not returning any things?

q; Alice and Strings | Practice Problems

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,i,j,t=0;
    string s1;
    string s2;
    cin>>s1;
    cin>>s2;
     int l=0; 
	 l = s1.length();
     i=l;
    while(i>0)
    {
        if(s1[i]==s2[i])
        {
            i--;
        }
        else
        {
			for(j=0;j<i;j++)
            {
                s1[j] = s1[j]+1;
            }
            i=i;
        }
    }
    for(k=0;k<l;k++)
    {
        if(s1[k]==s2[k])
        {
            t++;
        }
    }
    if(t==l)
    {
        cout<<"YES";
	}
        else
    {
         cout<<"NO";
    }
    return 0;
}

Nearly everything is wrong in this code.

  1. l=s1.length()===>l=s1.length()-1 {0 based indexing is used in c++}
  2. entering infinte loop thats by no output ==>
    let test case is s1=‘b’ and s2=‘a’
    now you are incrementing s1[0] till it is not equal to s2[0] which is not posible(maybe possible after overflow ).
    Rethink for a better approach. maybe calculating the difference of the first element from last
    and adding it to all and so on…