public boolean str(String s1,String s2)
{
char c=s1.charAt(s1.length()-1);
char c1=s2.charAt(0);
int count=0;
for(int i=0;i<s2.length();i++)
{
if(c1==c+1)
{
count++;
if(i<s2.length()-1)
{
c=s2.charAt(i);
c1=s2.charAt(i+1);
}
}
}
if(count==s2.length())
return true;
else
return false;
}
{
char c=s1.charAt(s1.length()-1);
char c1=s2.charAt(0);
int count=0;
for(int i=0;i<s2.length();i++)
{
if(c1==c+1)
{
count++;
if(i<s2.length()-1)
{
c=s2.charAt(i);
c1=s2.charAt(i+1);
}
}
}
if(count==s2.length())
return true;
else
return false;
}
No comments:
Post a Comment