import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
//        if (s.length()-t.length()>0){
//            n = s.length()-t.length();
//            s = s.substring(n,s.length());
//        }else if (t.length()-s.length()>0){
//            n = t.length()-s.length();
//            t = t.substring(n,t.length());
//        }

        int i = 0;
        int j = 0;
        i = s.length();
        j = t.length();
        int k = 1;
        n = i+j+2;
        while (true){
           if (s.charAt(s.length()-k)==t.charAt(t.length()-k)){
               n = i+j-2*k;
               k++;
           }else {
               break;
           }
           if (k==s.length()+1||k==t.length()+1){
               break;
           }
        }

        System.out.println(n);
    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
        if (s.length()-t.length()>0){

            n = s.length()-t.length();
            s = s.substring(n,s.length());
        }else if (t.length()-s.length()>0){
            n = t.length()-s.length();
            t = t.substring(n,t.length());
        }
        while (!s.equals(t)&&s.length()!=0){
            int k = 1;
            while (s.charAt(k)!=t.charAt(k)){
                k++;
            }
            s = s.substring(k,s.length());
            t = t.substring(k,t.length());
            n+=2;

        }
        System.out.println(n);

    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
//        StringBuffer sBuffer = new StringBuffer(s);
//        StringBuffer tBuffer = new StringBuffer(t);
        int n = 0;
        if (s.length()-t.length()>0){

            n = s.length()-t.length();
            s = s.substring(n,s.length());
        }else if (t.length()-s.length()>0){
            n = t.length()-s.length();
            t = t.substring(n,t.length());
        }
        while (!s.equals(t)&&s.length()!=0){
            s = s.substring(1,s.length());
            t = t.substring(1,t.length());
            n+=2;
//            if (s.length()==0||s.equals(t)){break;}

        }
        System.out.println(n);

    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
//        if (s.length()-t.length()>0){
//            n = s.length()-t.length();
//            s = s.substring(n,s.length());
//        }else if (t.length()-s.length()>0){
//            n = t.length()-s.length();
//            t = t.substring(n,t.length());
//        }

        int i = 0;
        int j = 0;
        i = s.length();
        j = t.length();
        int k = 1;
        n = i+j;
        while (true){
           if (s.charAt(s.length()-k)==t.charAt(t.length()-k)){
               n = i+j-2*k;
               k++;
           }else {
               break;
           }
           if (k==s.length()+1||k==t.length()+1){
               break;
           }
        }

        System.out.println(n);
    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
        if (s.length()-t.length()>0){

            n = s.length()-t.length();
            s = s.substring(n,s.length());
        }else if (t.length()-s.length()>0){
            n = t.length()-s.length();
            t = t.substring(n,t.length());
        }
        while (!s.equals(t)&&s.length()!=0){
            int k = 1;
            while (k<s.length()&&s.charAt(k)!=t.charAt(k)){
                k++;
            }
            s = s.substring(k,s.length());
            t = t.substring(k,t.length());
            n+=2*k;

        }
        System.out.println(n);

    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
//        if (s.length()-t.length()>0){
//            n = s.length()-t.length();
//            s = s.substring(n,s.length());
//        }else if (t.length()-s.length()>0){
//            n = t.length()-s.length();
//            t = t.substring(n,t.length());
//        }

        int i = 0;
        int j = 0;
        i = s.length()-1;
        j = t.length()-1;
        n = i+j+2;
        while (true){
           try {
               if (s.substring(i,s.length()).equals(t.substring(j,t.length()))){
                   n = i+j;
                   j--;
                   i--;
               }else {
                   break;
               }
           }catch (Exception e){
               break;
           }

        }

        System.out.println(n);
    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
        if (s.length()-t.length()>0){
            n = s.length()-t.length();
            s = s.substring(n,s.length());
        }else if (t.length()-s.length()>0){
            n = t.length()-s.length();
            t = t.substring(n,t.length());
        }
        while (!s.equals(t)&&s.length()!=0){
            if (s.length()==1){
                n+=2;
                break;
            }
            s = s.substring(1,s.length());
            t = t.substring(1,t.length());
            n+=2;
        }
        System.out.println(n);
    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        StringBuffer sBuffer = new StringBuffer(s);
        StringBuffer tBuffer = new StringBuffer(t);
        int n = 0;
        if (s.length()-t.length()>0){
            n = s.length()-t.length();
            s = s.substring(n,s.length());
        }else if (t.length()-s.length()>0){
            n = t.length()-s.length();
            t = t.substring(n,t.length());
        }
        if (s.equals(t)){
            System.out.println(n);
            return;
        }
        while (true){
            s = s.substring(1,s.length());
            t = t.substring(1,t.length());
            n+=2;
            if (s.equals(t)){break;}
            if (s.length()==0||t.length()==0){break;}

        }
        System.out.println(n);

    }

}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class main2 {

    public static void main(String []args){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int n = 0;
//        if (s.length()-t.length()>0){
//            n = s.length()-t.length();
//            s = s.substring(n,s.length());
//        }else if (t.length()-s.length()>0){
//            n = t.length()-s.length();
//            t = t.substring(n,t.length());
//        }

        int i = 0;
        int j = 0;
        i = s.length()-1;
        j = t.length()-1;
        n = i+j+2;
        while (true){
           if (s.substring(i,s.length()).equals(t.substring(j,t.length()))){
               n = i+j;
               j--;
               i--;
           }else {
               break;
           }
            if (i<=0||j<=0){
                break;
            }
        }

        System.out.println(n);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class EqualStrings
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String st1 = reader.readLine();
		String st2 = reader.readLine();
		if (st1.endsWith(st2))
		{
			System.out.println(st1.length() - st2.length());
			System.exit(0);
		}
		StringBuilder hold2 = new StringBuilder(st2.substring(st2.length() - 1, st2.length()));
		int ind = st2.length() - 2;
		while (st1.endsWith(hold2.toString()))
		{
			hold2.insert(0, st2.charAt(ind));
			ind--;
		}
		System.out.println(st1.length() - hold2.length() + st2.length() - hold2.length()  + 2);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class EqualStrings
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder st1 = new StringBuilder(reader.readLine());
		StringBuilder st2 = new StringBuilder(reader.readLine());
		int del = 0;
		if (st1.length() > st2.length())
		{
			del += st1.length() - st2.length();
			st1.delete(0, del);
		}
		else if (st1.length() < st2.length())
		{
			del += st2.length() - st1.length();
			st2.delete(0, del);
		}
		while (!st1.toString().equals(st2.toString()))
		{
			del += 2;
			st1.delete(0, 1);
			st2.delete(0, 1);
		}
		System.out.println(del);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class EqualStrings
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String st1 = reader.readLine();
		String st2 = reader.readLine();
		StringBuilder hold2 = new StringBuilder(st2.substring(st2.length() - 1, st2.length()));
		if (st1.endsWith(st2))
		{
			System.out.println(st1.length() - st2.length());
			System.exit(0);
		}
		while (st1.endsWith(hold2.toString()))
			hold2.insert(0, st2.substring(st2.length() - hold2.length() - 1, st2.length() - hold2.length()));
		System.out.println(st1.length() - hold2.length() + st2.length() - hold2.length()  + 2);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class EqualStrings
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String st1 = reader.readLine();
		String st2 = reader.readLine();
		String hold1 = st1.substring(st1.length() - 1, st1.length());
		String hold2 = st2.substring(st2.length() - 1, st2.length());
		while (hold1.equals(hold2) && hold1.length() < st1.length() && hold2.length() < st2.length())
		{
			hold1 = st1.substring(st1.length() - hold1.length() - 1, st1.length());
			hold2 = st2.substring(st2.length() - hold2.length() - 1, st2.length());
		}
		int del = 0;
		if (hold1.equals(hold2))
		{
			if (st1.length() > st2.length())
				del += st1.length() - st2.length();
			else
				del += st2.length() - st1.length();
		}
		else
			del += st1.length() - hold1.length() + st2.length() - hold2.length() + 2;
		System.out.println(del);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class EqualStrings
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String st1 = reader.readLine();
		String st2 = reader.readLine();
		if (st1.endsWith(st2))
		{
			System.out.println(st1.length() - st2.length());
			System.exit(0);
		}
		int start = 0;
		int end = st2.length();
		int mid = (start + end) / 2;
		int best = end;
		StringBuilder sb = new StringBuilder(st2.substring(mid, st2.length()));
		while (start <= end)
		{
			if (!st1.endsWith(sb.toString()))
				start = mid + 1;
			else
			{
				end = mid - 1;
				best = mid;
			}
			mid = (start + end) / 2;
			sb.delete(0, sb.length());
			sb.append(st2.substring(mid, st2.length()));
		}
		System.out.println(best + st1.length() - st2.length() + best);
	}
}


import java.util.*;
public class TestClass {
    public static void main(String args[] ){

        String a,b;
        Scanner s=new Scanner(System.in);
        a=s.nextLine();
        b=s.nextLine();

        int count=0;
        for(int i=a.length()-1;i>=0;i--)
        {
            if(a.charAt(i)==b.charAt(i))
            {
                count+=2;
            }
            else
                break;
        }

        System.out.println(a.length()+b.length()-count);
    }
}


import java.util.*;
public class TestClass {
    public static void main(String args[] ) throws Exception{

        String a,b;
        Scanner s=new Scanner(System.in);
        a=s.next();
        b=s.next();

        int count=0;
        int j=b.length()-1;
        for(int i=a.length()-1;i>=0&&j>=0;i--,j--)
        {
            if(a.charAt(i)==b.charAt(j))
            {
                count+=2;
            }
            else
                break;
        }
        System.out.println(a.length()+b.length()-count);
    }
}


import java.util.*;
public class TestClass {
    public static void main(String args[] ) throws Exception{

        String a,b;
        Scanner s=new Scanner(System.in);
        a=s.next();
        b=s.next();

        int count=0;
        for(int i=a.length()-1;i>=0;i--)
        {
            if(a.charAt(i)==b.charAt(i))
            {
                count+=2;
            }
            else
                break;
        }
        System.out.println(a.length()+b.length()-count);
    }
}


import java.util.Scanner;

public class Main
{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
        String s1 = s.nextLine();
        String s2 = s.nextLine();
        String temp = "";
        int res=0;
        int count;
        if(s1.length()<s2.length()){
            temp = s1;
            s1 = s2;
            s2 = temp;
        }
        count = s2.length()-1;
        while(count>=0){
    if ( s2.charAt(count) == s1.charAt(s1.length()-s2.length()+count) ){
          res++;
          count--;
          }
    else
        break;
        }
     System.out.println(s1.length()+s2.length()-2*res);
	}
}


import java.util.Scanner;

public class Main
{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
        String s1 = s.nextLine();
        String s2 = s.nextLine();
        String temp = "";
        int res=0;
        int count;
        if(s1.length()<s2.length()){
            temp = s1;
            s1 = s2;
            s2 = s1;
        }
        count = s2.length()-1;
        while(count>=0){
    if ( s2.charAt(count) == s1.charAt(s1.length()-s2.length()+count) ){
          res++;
          count--;
          }
    else
        break;
        }
     System.out.println(s1.length()+s2.length());
     System.out.println(res);
	}
}


import java.util.Scanner;

public class Main
{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
        String s1 = s.nextLine();
        String s2 = s.nextLine();
        String temp = "";
        int res=0;
        int count;
        if(s1.length()<s2.length()){
            temp = s1;
            s1 = s2;
            s2 = s1;
        }
        count = s2.length()-1;
        while(count>=0){
    if ( s2.charAt(count) == s1.charAt(s1.length()-s2.length()+count) ){
          res++;
          count--;
          }
    else
        break;
        }
     System.out.println(s1.length()+s2.length()-2*res);
	}
}


import java.io.*;
import java.util.*;

public class deleteLeft{

    public static void main(String [] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        String bigger = f.readLine(), smaller = f.readLine();

        if(smaller.length() > bigger.length()){
            String temp = smaller;
            smaller = bigger;
            bigger = temp;
        }

        char[] bigArray = bigger.toCharArray(), smallArray = smaller.toCharArray();
        int num = 0, total = 0;

        for(int i = 0; i < smallArray.length; i++){
            if(bigArray[bigArray.length - 1 - i] == smallArray[smallArray.length - 1 - i]){
                num += 1;
            }else{
                break;
            }
        }

        total = bigArray.length + smallArray.length - 2 * num;

        System.out.println(num);
    }

}


import java.io.*;
import java.util.*;

public class deleteLeft{

    public static void main(String [] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        String bigger = f.readLine(), smaller = f.readLine();

        if(smaller.length() > bigger.length()){
            String temp = smaller;
            smaller = bigger;
            bigger = temp;
        }

        char[] bigArray = bigger.toCharArray(), smallArray = smaller.toCharArray();
        int num = 0, total = 0;

        for(int i = 0; i < smallArray.length; i++){
            if(bigArray[bigArray.length - 1 - i] == smallArray[smallArray.length - 1 - i]){
                num += 1;
            }else{
                break;
            }
        }

        total = bigArray.length + smallArray.length - 2 * num;

        System.out.println(num);
    }

}
close


import java.io.*;
import java.util.*;

public class deleteLeft{

    public static void main(String [] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        String bigger = f.readLine(), smaller = f.readLine();

        if(smaller.length() > bigger.length){
            String temp = smaller;
            smaller = bigger;
            bigger = temp;
        }

        char[] bigArray = bigger.toCharArray(), smallArray = smaller.toCharArray();
        int num = 0, total = 0;

        for(int i = 0; i < smallArray.length; i++){
            if(bigArray[bigArray.length - 1 - i] == smallArray[smallArray.length - 1 - i]){
                num += 1;
            }else{
                break;
            }
        }

        total = bigArray.length + smallArray.length - 2 * num;

        System.out.println(num);
    }

}


import java.io.*;
import java.util.*;

public class deleteLeft{

    public static void main(String [] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        String bigger = f.readLine(), smaller = f.readLine();

        if(smaller.length() > bigger.length()){
            String temp = smaller;
            smaller = bigger;
            bigger = temp;
        }

        char[] bigArray = bigger.toCharArray(), smallArray = smaller.toCharArray();
        int num = 0, total = 0;

        for(int i = 0; i < smallArray.length; i++){
            if(bigArray[bigArray.length - 1 - i] == smallArray[smallArray.length - 1 - i]){
                num += 1;
            }else{
                break;
            }
        }

        total = bigArray.length + smallArray.length - 2 * num;

        System.out.println(total);
    }

}


import java.util.Scanner;

public class JavaApplication173 {

    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);

     String a = sc.next();
     String b = sc.next();

     long count = 0;

     while(!a.equals("") && !b.equals("")){
         if(a.equals(b)){
             System.out.println(count); return;
         }
         if(a.length() > b.length()){
             a = a.substring(1);
             count++;
         }else if(b.length() > a.length()){
             b = b.substring(1);
             count++;
         }else{
             a = a.substring(1);
             b = b.substring(1);
             count = count + 2;
         }
     }

     System.out.println(count);
    }
}


import java.util.Scanner;

public class JavaApplication173 {

    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);

     String a = sc.next();
     String b = sc.next();

     int v = 0;

     while(true){

         int i = a.length() - v - 1;
         int j = b.length() - v - 1;

         if(i>=0 && j>=0 && a.charAt(i) == b.charAt(j))
             v++;
         else
             break;
     }
     System.out.println(a.length() + b.length() - 2 * v);
    }
}


import java.util.Scanner;

public class JavaApplication173 {

    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);

     String a = sc.next();
     String b = sc.next();

     int count = 0;

     while(!a.equals("") && !b.equals("")){
         if(a.equals(b)){
             System.out.println(count); return;
         }
         if(a.length() > b.length()){
             a = a.substring(1); count++;

         }else if(b.length() > a.length()){
             b = b.substring(1); count++;

         }else{
             a = a.substring(1);
             b = b.substring(1);
             count = count + 2;
         }
     }

     System.out.println(count);
    }
}


import java.util.Scanner;

public class JavaApplication173 {

    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);

     String a = sc.next();
     String b = sc.next();

     int count = 0;
     int m = Math.max(a.length(), b.length()) - Math.min(a.length(), b.length());
     if(a.length() > b.length())
         a = a.substring(m);
     else if(b.length() > a.length())
         b = b.substring(m);

     while(!a.equals("") && !b.equals("")){
         if(a.equals(b)){
             System.out.println(m+count); return;
         }
             a = a.substring(1);
             b = b.substring(1);
             count = count + 2;
     }

     System.out.println((m+count));
    }
}


import java.util.Scanner;
public class Main{
  public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  String s = sc.nextLine();
  int l1 = s.length();
  char[] c1 = s.toCharArray();
  String t = sc.nextLine();
  int l2 = t.length();
  char[] c2 = t.toCharArray();
  int l = l1+l2;
  int i, j;
  int c=0;
  for(i=l1-1,j=l2-1; i>=0 && j>=0; i--,j--){
    if(c1[i]==c2[j]){
    c+=2;
    }
    else
      break;
  }
  int p = l-c;
  System.out.println(p);
  }
}


import java.util.Scanner;
public class Main{
  public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  String s = sc.nextLine();
  int l1 = s.length();
  char[] c1 = s.toCharArray();
  String t = sc.nextLine();
  int l2 = t.length();
  char[] c2 = t.toCharArray();
  int l = l1+l2;
  int i, j;
  int c=0;
  for(i=l1-1,j=l2-1; i>=0 && j>=0; i--,j--){
    if(c1[i]==c2[j]){
    c+=2;
    }
  }
  int p = l-c;
  System.out.println(p);
  }
}


import java.util.Scanner;
public class Main{
  public static void main(String args[]){
  Scanner sc = new Scanner(System.in);
  String s = sc.next();
  int l1 = s.length();
  char[] c1 = s.toCharArray();
  String t = sc.nextLine();
  int l2 = t.length();
  char[] c2 = t.toCharArray();
  int l = l1+l2;
  int i, j;
  int c=0;
  for(i=l1-1,j=l2-1; i>=0 && j>=0; i--,j--){
    if(c1[i]==c2[j]){
    c+=2;
    }
  }
  int p = l-c;
  System.out.println(p);
  }
}


import java.util.Scanner;

public class Problem_1005B {

    public static void main(String[] args) {

        Scanner obj=new Scanner(System.in);

        char s[]=obj.next().toCharArray();
        char t[]=obj.next().toCharArray();

        int i=s.length-1;
        int j=t.length-1;

        while(i>=0 && j>=0)
        {
          if(s[i]!=t[j])
          {
              break;
          }
          i--;
          j--;
        }

        System.out.println(i+j+1+1);

        }


import java.util.Scanner;

public class Problem_1005B {

    public static void main(String[] args) {

        Scanner obj=new Scanner(System.in);

        String s1=obj.next();
        String s2=obj.next();

         String a=s1;
         String b=s2;

         int count=0;
         for (int i =1; i <=2000; i++) {
         if(a.length()<b.length())
           {
               b=b.substring(1);

               count++;
           }
           else if(a.length()>b.length())
           {
               a=a.substring(1);

               count++;
           }
           else if(a.length()==b.length())
           {
              if(a.equals(b))
              {
                  break;
              }
              else
              {
                  a=a.substring(1);
                  b=b.substring(1);

                  count=count+2;
              }
           }

        }

        System.out.println(count);
    }

}


import java.util.Scanner;

public class Problem_1005B {

    public static void main(String[] args) {

        Scanner obj=new Scanner(System.in);

        String s1=obj.next();
        String s2=obj.next();

         String a=s1;
         String b=s2;

         int count=0;
         for (int i =1; i <=2000; i++) {
         if(a.length()<b.length())
           {
             //  b=b.substring(1);
              // count++;
               count=count+(b.length()-a.length());

                b=b.substring((b.length()-a.length()),b.length());

           }
           else if(a.length()>b.length())
           {
              // a=a.substring(1);
               //count++;

               count=count+(a.length()-b.length());

               a=a.substring((a.length()-b.length()),a.length());

           }
           else if(a.length()==b.length())
           {
              if(a.equals(b))
              {
                  break;
              }
              else
              {
                  a=a.substring(1);
                  b=b.substring(1);

                  count=count+2;
              }
           }

        }

        System.out.println(count);
    }

}


import java.util.Scanner;

public class Problem_1005B {

    public static void main(String[] args) {

        Scanner obj=new Scanner(System.in);

        String s1=obj.next();
        String s2=obj.next();

         String a=s1;
         String b=s2;

         int count=0;
         for (int i =1; i <=200000; i++) {
         if(a.length()<b.length())
           {
             //  b=b.substring(1);
              // count++;
               count=count+(b.length()-a.length());

                b=b.substring((b.length()-a.length()),b.length());

           }
           else if(a.length()>b.length())
           {
              // a=a.substring(1);
               //count++;

               count=count+(a.length()-b.length());

               a=a.substring((a.length()-b.length()),a.length());

           }
           else if(a.length()==b.length())
           {
              if(a.equals(b))
              {
                  break;
              }
              else
              {
                  a=a.substring(1);
                  b=b.substring(1);

                  count=count+2;
              }
           }

        }

        System.out.println(count);
    }

}


import java.util.Scanner;

public class Problem_1005B {

    public static void main(String[] args) {

        Scanner obj=new Scanner(System.in);

        char s[]=obj.next().toCharArray();
        char t[]=obj.next().toCharArray();

        int i=s.length-1;
        int j=t.length-1;

        while(i>=0 && j>=0)
        {
          if(s[i]!=t[j])
          {
              break;
          }
          i--;
          j--;
        }

        System.out.println(i+j+1+1);

        }

    }


////package math_codet;

import java.io.*;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    InputReader in;
    PrintWriter out;
    Helper_class h;
    final long mod=1000000007;
    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new InputReader();
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t=1;
        while(t-->0){
            solve();
        }
        out.flush();
        out.close();
    }
    int n;
    int m;
    int[] arr;
    void solve(){
        String st1=h.nln();
        String st2=h.nln();
        int i=0,j=0;
        int count=0;
        for(i=st1.length()-1,j=st2.length()-1;i>=0 && j>=0;i--,j--){
            if(st1.charAt(i)==st2.charAt(j))
                count+=2;
            else
                break;
        }
        h.pn(st1.length()+st2.length()-count);
    }
    static final Comparator<Entity> com=new Comparator<Entity>(){
        public int compare(Entity a, Entity b){
            int xx=Integer.compare(a.x,b.x);
            if(xx==0)
                return Integer.compare(a.y,b.y);
            else
                return xx;
        }
    };
    class Entity{
        int x, y;
        Entity(int p, int q){
            x=p;
            y=q;
        }
    }
    class Helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
        long gcd1(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
        void p(Object o){out.print(o);}
        void pn(Object o){out.println(o);}
        void pni(Object o){out.println(o);out.flush();}
        String n(){return in.next();}
        String nln(){return in.nextLine();}
        int ni(){return Integer.parseInt(in.next());}
        long nl(){return Long.parseLong(in.next());}
        double nd(){return Double.parseDouble(in.next());}

        long mul(long a,long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            a*=b;
            if(a>=mod)a%=mod;
            return a;
        }
        long modPow(long a, long p){
            long o = 1;
            while(p>0){
                if((p&1)==1)o = mul(o,a);
                a = mul(a,a);
                p>>=1;
            }
            return o;
        }
        long add(long a, long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            if(b<0)b+=mod;
            a+=b;
            if(a>=mod)a-=mod;
            return a;
        }
    }

    class InputReader{
        BufferedReader br;
        StringTokenizer st;
        public InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public InputReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
}


/*input
b
ab
*/

import java.util.*;
public class B
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		String a=sc.next();
		String b=sc.next();
		int al=a.length();
		int bl=b.length();
		int i;
		for(i=0;i<Math.min(al,bl);i++)
		{
			if(a.charAt(al-i-1)!=b.charAt(bl-i-1))
				break;
		}
		System.out.println(al-i+bl-i);
	}
	public static void show(String s)
	{
		System.out.println(s);
	}
}


//package math_codet;

import java.io.*;
import java.util.*;
 /******************************************
*    AUTHOR:         AMAN KUMAR SINGH        *
*    INSTITUITION:   KALYANI GOVERNMENT ENGINEERING COLLEGE  *
******************************************/
public class lets_do {
    InputReader in;
    PrintWriter out;
    Helper_class h;
    final long mod=1000000007;
    public static void main(String[] args) throws java.lang.Exception{
        new lets_do().run();
    }
    void run() throws Exception{
        in=new InputReader();
        out = new PrintWriter(System.out);
        h = new Helper_class();
        int t=1;
        while(t-->0){
            solve();
        }
        out.flush();
        out.close();
    }
    int n;
    int m;
    int[] arr;
    void solve(){
        String st1=h.nln();
        String st2=h.nln();
        int i=0,j=0;
        int count=0;
        for(i=st1.length()-1,j=st2.length()-1;i>=0 && j>=0;i--,j--){
            if(st1.charAt(i)==st2.charAt(j))
                count+=2;
            else
                break;
        }
        h.pn(st1.length()+st2.length()-count);
    }
    static final Comparator<Entity> com=new Comparator<Entity>(){
        public int compare(Entity a, Entity b){
            int xx=Integer.compare(a.x,b.x);
            if(xx==0)
                return Integer.compare(a.y,b.y);
            else
                return xx;
        }
    };
    class Entity{
        int x, y;
        Entity(int p, int q){
            x=p;
            y=q;
        }
    }
    class Helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
        long gcd1(long a, long b){return (b==0)?a:gcd(b,a%b);}
        int bitcount(long n){return (n==0)?0:(1+bitcount(n&(n-1)));}
        void p(Object o){out.print(o);}
        void pn(Object o){out.println(o);}
        void pni(Object o){out.println(o);out.flush();}
        String n(){return in.next();}
        String nln(){return in.nextLine();}
        int ni(){return Integer.parseInt(in.next());}
        long nl(){return Long.parseLong(in.next());}
        double nd(){return Double.parseDouble(in.next());}

        long mul(long a,long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            a*=b;
            if(a>=mod)a%=mod;
            return a;
        }
        long modPow(long a, long p){
            long o = 1;
            while(p>0){
                if((p&1)==1)o = mul(o,a);
                a = mul(a,a);
                p>>=1;
            }
            return o;
        }
        long add(long a, long b){
            if(a>=mod)a%=mod;
            if(b>=mod)b%=mod;
            if(b<0)b+=mod;
            a+=b;
            if(a>=mod)a-=mod;
            return a;
        }
    }

    class InputReader{
        BufferedReader br;
        StringTokenizer st;
        public InputReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public InputReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
import java.io.*;
public class Hua{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
     String s=sc.next();
     String t=sc.next();
     StringBuilder sb1 = new StringBuilder(s);
     s=sb1.reverse().toString();
     StringBuilder tb1 = new StringBuilder(t);
     t=tb1.reverse().toString();
     //System.out.println(s+" "+t);
     long sl=s.length();
     long tl=t.length();
     long l=Math.min(sl,tl);
     //System.out.println(sl+"  "+tl+"  "+"  "+l);
     long count=0;
     for(int i=0;i<l;i++){
     if(s.charAt(0)!=t.charAt(0)){
        break;
     }
     if(s.charAt(i)==t.charAt(i)){
          count++;
     }
}
System.out.println(sl+tl-2*count);
  }
}


import java.util.*;
import java.io.*;
public class Hua{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
     String s=sc.next();
     String t=sc.next();
     StringBuilder sb1 = new StringBuilder(s);
     s=sb1.reverse().toString();
     StringBuilder tb1 = new StringBuilder(t);
     t=tb1.reverse().toString();
     //System.out.println(s+" "+t);
     int sl=s.length();
     int tl=t.length();
     int l=Math.min(sl,tl);
     //System.out.println(sl+"  "+tl+"  "+"  "+l);
     int count=0;
     for(int i=0;i<l;i++){
     if(s.charAt(0)!=t.charAt(0)){
        break;
     }
     if(s.charAt(i)==t.charAt(i)){
          count++;
     }
}
System.out.println(sl+tl-2*count);
  }
}


import java.util.*;
import java.io.*;
public class Hua{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
     String s=sc.next();
     String t=sc.next();
     StringBuilder sb1 = new StringBuilder(s);
     s=sb1.reverse().toString();
     StringBuilder tb1 = new StringBuilder(t);
     t=tb1.reverse().toString();
     //System.out.println(s+" "+t);
     long sl=s.length();
     long tl=t.length();
     long l=Math.min(sl,tl);
     //System.out.println(sl+"  "+tl+"  "+"  "+l);
     long count=0;
     for(int i=0;i<l;i++){
          if(s.charAt(i)==t.charAt(i)){
               count++;
          }
          else
               break;
     }
System.out.println(sl+tl-2*count);
  }
}


import java.util.*;
import java.io.*;
public class Hua{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
     String s=sc.next();
     String t=sc.next();
StringBuilder sb1 = new StringBuilder(s);
s=sb1.reverse().toString();
StringBuilder tb1 = new StringBuilder(t);
t=tb1.reverse().toString();
int sl=s.length();
int tl=t.length();
int l=Math.min(sl,tl);
//System.out.println(l);
int count=0;
for(int i=0;i<l;i++){
     if(s.charAt(0)!=t.charAt(0)){
          break;
     }
     if(s.charAt(i)==t.charAt(i)){
          count++;
     }
}
System.out.println(sl+tl-2*count);
  }
}


import java.util.*;
import java.io.*;
public class Hua{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
     String s=sc.next();
     String t=sc.next();
StringBuilder sb1 = new StringBuilder(s);
s=sb1.reverse().toString();
StringBuilder tb1 = new StringBuilder(t);
t=tb1.reverse().toString();
int sl=s.length();
int tl=t.length();
int l=Math.min(sl,tl);
//System.out.println(l);
int count=0;
for(int i=0;i<l;i++){
     if(s.charAt(i)==t.charAt(i)){
          count++;
     }
}
System.out.println(sl+tl-2*count);
  }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i).equals(b.substring(b.length()-1-i))) {
        i++;
      }

      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i,a.length()-i).equals(
            b.substring(b.length()-1-i,b.length()-i)) {
        i++;
        if (a.length()-1-i <= 0 || b.length()-1-i <= 0) {
            break;
        }
      }
      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i).equals(b.substring(b.length()-1-i)) {
        i++;
      }

      System.out.print(a.length()-i + b.length()-i);
/*
     //讀 input 進來的值：
     ArrayList<String> inputList = readInput();
     //題目的第一個 input是下面第二個 input 的 size (另外：這個值在這題目完全是個無用值,所以根本沒用到)
     int size = Integer.parseInt(inputList.get(0));
     //題目的第二個 input 是一連串數字, 這邊用 getIntListFromString 的方法把 input parse 成 integer 的 list
     ArrayList<Integer> originalList = getIntListFromString(inputList.get(1));

     //計算過程
     ArrayList<Integer> resultList = new ArrayList();
      for(int i = 0; i < originalList.size(); i++){
          if((originalList.get(i) == 1 && i != 0)){
              resultList.add(originalList.get((i-1)));
          }
          if((i == originalList.size() - 1)){
              resultList.add(originalList.get((i)));
          }
      }

      //output 結果：
      //這邊第一個 output 需要印出總共有幾個樓梯
      System.out.println(""+ resultList.size());
      //第二個 output 需要印出每個樓梯含有幾個台階, 是一連串的數字
      outputIntegerListResult(resultList);
      */
    }

    //這串有點長直接弄成一個 function比較方便
    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

    //這串有點長直接弄成一個 function比較方便, 把 readInput的結果parse成 integer的 list
      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i,1).equals(b.substring(b.length()-1-i,1)) {
        i++;
        if (a.length()-1-i <= 0 || b.length()-1-i <= 0) {
            break;
        }
      }
      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      if (a.length() == 0 || b.length() == 0 ) {
        System.out.print(a.length() + b.length());
        return;
      }

      if (a.equals(b) == 0) {
        System.out.print(0);
        return;
      }

      int i = 0;
      int index = 0;

      String c, d;
      if (a.length() >= b.length()) {
        c = a;
        d = b;
      }
      else {
        c = b;
        d = a;
      }
      do {
        index = c.indexOf(d, index);
        if (index == -1) {
          i++;
          d = d.subString(i, d.length()-1);
        }
        else {
          System.out.print(i+index);
        }
      }
      while (c.length() > 0 && d.length() > 0);

      System.out.print(a.length()+b.length());
    }

    //這串有點長直接弄成一個 function比較方便
    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

    //這串有點長直接弄成一個 function比較方便, 把 readInput的結果parse成 integer的 list
      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i,a.length()-i).equals(b.substring(b.length()-1-i,b.length()-i))) {
        i++;
        if (a.length()-i <= 0 || b.length()-i <= 0) {
            break;
        }
      }
      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      if (a.length() == 0 || b.length() == 0 ) {
        System.out.print(a.length() + b.length());
        return;
      }

      if (a.equals(b) == 0) {
        System.out.print(0);
        return;
      }

      int i = 0;
      int index = 0;

      String c, d;
      if (a.length() >= b.length()) {
        c = a;
        d = b;
      }
      else {
        c = b;
        d = a;
      }
      do {
        index = c.indexOf(d, index);
        if (index == -1) {
          i++;
          d = d.subString(i, d.length()-1);
        }
        else {
          System.out.print(i+index);
        }
      }
      while (c.length() > 0 && d.length() > 0);

      System.out.print(a.length()+b.length());
    }

    public static void outputIntegerListResult(ArrayList<Integer> list) {
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

    public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      if (a.length() == 0 || b.length() == 0 ) {
        System.out.print(a.length() + b.length());
        return;
      }

      if (a.equals(b) == 0) {
        System.out.print(0);
        return;
      }

      int i = 0;
      int index = 0;

      String c, d;
      if (a.length() >= b.length()) {
        c = a;
        d = b;
      }
      else {
        c = b;
        d = a;
      }
      do {
        index = c.indexOf(d, index);
        if (index == -1) {
          i++;
          d = d.subString(i, d.length()-1);
        }
        else {
          System.out.print(i+index);
        }
      }
      while (c.length() > 0 && d.length() > 0);

      System.out.print(a.length()+b.length());
/*
     //讀 input 進來的值：
     ArrayList<String> inputList = readInput();
     //題目的第一個 input是下面第二個 input 的 size (另外：這個值在這題目完全是個無用值,所以根本沒用到)
     int size = Integer.parseInt(inputList.get(0));
     //題目的第二個 input 是一連串數字, 這邊用 getIntListFromString 的方法把 input parse 成 integer 的 list
     ArrayList<Integer> originalList = getIntListFromString(inputList.get(1));

     //計算過程
     ArrayList<Integer> resultList = new ArrayList();
      for(int i = 0; i < originalList.size(); i++){
          if((originalList.get(i) == 1 && i != 0)){
              resultList.add(originalList.get((i-1)));
          }
          if((i == originalList.size() - 1)){
              resultList.add(originalList.get((i)));
          }
      }

      //output 結果：
      //這邊第一個 output 需要印出總共有幾個樓梯
      System.out.println(""+ resultList.size());
      //第二個 output 需要印出每個樓梯含有幾個台階, 是一連串的數字
      outputIntegerListResult(resultList);
      */
    }

    //這串有點長直接弄成一個 function比較方便
    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

    //這串有點長直接弄成一個 function比較方便, 把 readInput的結果parse成 integer的 list
      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      if (a.length() == 0 || b.length() == 0 ) {
        System.out.print(a.length() + b.length());
        return;
      }

      if (a.equals(b)) {
        System.out.print(0);
        return;
      }

      int i = 0;
      int index = 0;

      String c, d;
      if (a.length() >= b.length()) {
        c = a;
        d = b;
      }
      else {
        c = b;
        d = a;
      }
      do {
        index = c.indexOf(d, index);
        if (index == -1) {
          i++;
          d = d.substring(i, d.length()-1);
        }
        else {
          System.out.print(i+index);
        }
      }
      while (c.length() > 0 && d.length() > 0);

      System.out.print(a.length()+b.length());
    }

    public static void outputIntegerListResult(ArrayList<Integer> list) {
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

    public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i).equals(b.substring(b.length()-1-i)) {
        i++;
      }

      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i).equals(b.substring(b.length()-1-i))) {
        i++;
        if (a.length()-1-i == 0 || b.length()-1-i == 0) {
            break;
        }
      }
      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i,a.length()-i).equals(b.substring(b.length()-1-i,b.length()-i))) {
        i++;
        if (a.length()-1-i <= 0 || b.length()-1-i <= 0) {
            break;
        }
      }
      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


import java.util.*;

public final class Main{
   public static void main(String[] args) {
      ArrayList<String> inputList = readInput();
      String a = inputList.get(0);
      String b = inputList.get(1);

      int i = 0;
      while (a.substring(a.length()-1-i,1).equals(b.substring(b.length()-1-i,1))) {
        i++;
        if (a.length()-1-i <= 0 || b.length()-1-i <= 0) {
            break;
        }
      }
      System.out.print(a.length()-i + b.length()-i);
    }

    public static void outputIntegerListResult(ArrayList<Integer> list){
      StringBuilder sb = new StringBuilder();
      for(int i = 0; i < list.size(); i++){
          sb.append(list.get(i)).append(" ");
      }
      System.out.println(sb.toString());
    }

    //讀取 input, 這邊用 nextLine 才不會第一個 input 跟第二個 input 傻傻搞不清楚
    //因為我自己在讀取的時候才發現題目有兩個 input, 我直接讀 nextInt 結果跟第二個 input 混在一起了
    //因為第一個值我完全沒用到所以沒注意到
      public static ArrayList<String> readInput(){
      ArrayList<String> inputList = new ArrayList();
      Scanner sc = new Scanner(System.in);
      while(sc.hasNext()){
          inputList.add(sc.nextLine());
      }
      return inputList;
    }

      public static ArrayList<Integer> getIntListFromString(String str){
      String[] strArray = str.split(" ");
      ArrayList<Integer> intList = new ArrayList();
      for(int i = 0; i < strArray.length; i++){
        intList.add(Integer.parseInt(strArray[i]));
      }
      return intList;
    }
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/* Name of the class has to be "Main" only if the class is public. */
public class bbg
{
	public static int result;

public static ArrayList<Integer> [] graph;

public static int[]cats;

public static int vizitat[];
public static int x;
//public static HashMap<String, Integer> map2;

	public static void main (String[] args) throws java.lang.Exception
{

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> contor1= new HashMap<Integer, Integer>();
HashMap<Integer, Integer> contor2= new HashMap<Integer, Integer>();

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();
HashMap<String, Integer> stringuri= new HashMap<String, Integer>();
HashMap<String, Integer> combinari= new HashMap<String, Integer>();

		String a=input.next();
		String b=input.next();
		int com=0;

		int lena=a.length();
		int lenb=b.length();

		for(int i=1;i<=lena;i++) if(i<=lenb) if(a.charAt(lena-i)==b.charAt(lenb-i)) com++;
			//System.out.println(com);

			int rez=lena+lenb-2*com;

		System.out.println(rez);

	}

	}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/* Name of the class has to be "Main" only if the class is public. */
public class bbg
{
	public static int result;

public static ArrayList<Integer> [] graph;

public static int[]cats;

public static int vizitat[];
public static int x;
//public static HashMap<String, Integer> map2;

	public static void main (String[] args) throws java.lang.Exception
{

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> contor1= new HashMap<Integer, Integer>();
HashMap<Integer, Integer> contor2= new HashMap<Integer, Integer>();

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();
HashMap<String, Integer> stringuri= new HashMap<String, Integer>();
HashMap<String, Integer> combinari= new HashMap<String, Integer>();

		String a=input.next();
		String b=input.next();
		int com=0;

		int lena=a.length();
		int lenb=b.length();

		for(int i=1;i<=lena;i++) if(i<=lenb) if(a.charAt(lena-i)==b.charAt(lenb-i)) com++;
			//System.out.println(com);

			int rez=lena+lenb-2*com;

			if (lena>3) if ( a.substring(0,4).equals("aaaa")) System.out.println(lena+" "+lenb+" "+com);

		System.out.println(rez);

	}

	}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/* Name of the class has to be "Main" only if the class is public. */
public class bbg
{
	public static int result;

public static ArrayList<Integer> [] graph;

public static int[]cats;

public static int vizitat[];
public static int x;
//public static HashMap<String, Integer> map2;

	public static void main (String[] args) throws java.lang.Exception
{

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> contor1= new HashMap<Integer, Integer>();
HashMap<Integer, Integer> contor2= new HashMap<Integer, Integer>();

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();
HashMap<String, Integer> stringuri= new HashMap<String, Integer>();
HashMap<String, Integer> combinari= new HashMap<String, Integer>();

		String a=input.next();
		String b=input.next();
		int com=0;

		int lena=a.length();
		int lenb=b.length();

		for(int i=1;i<=lena;i++) if(i<=lenb) if(a.charAt(lena-i)==b.charAt(lenb-i)) com++;
			//System.out.println(com);

			int rez=lena+lenb-2*com;

			if (lena>3) if ( a.substring(0,4).equals("aaaa"))
		{	System.out.println(lena+" "+lenb+" "+com);
System.out.println(a.substring(0,100));
System.out.println(b.substring(0,100));

		}

		System.out.println(rez);

	}

	}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/* Name of the class has to be "Main" only if the class is public. */
public class bbg
{
	public static int result;

public static ArrayList<Integer> [] graph;

public static int[]cats;

public static int vizitat[];
public static int x;
//public static HashMap<String, Integer> map2;

	public static void main (String[] args) throws java.lang.Exception
{

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> contor1= new HashMap<Integer, Integer>();
HashMap<Integer, Integer> contor2= new HashMap<Integer, Integer>();

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();
HashMap<String, Integer> stringuri= new HashMap<String, Integer>();
HashMap<String, Integer> combinari= new HashMap<String, Integer>();

		String a=input.next();
		String b=input.next();
		int com=0;

		int lena=a.length();
		int lenb=b.length();

		for(int i=1;i<=lena;i++) if(i<=lenb) if(a.charAt(lena-i)==b.charAt(lenb-i)) com++;
			//System.out.println(com);

			int rez=lena+lenb-2*com;

			if (a.substring(0,4).equals("aaaa")) System.out.println(lena+" "+lenb+" "+com);

		System.out.println(rez);

	}

	}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/* Name of the class has to be "Main" only if the class is public. */
public class bbg
{
	public static int result;

public static ArrayList<Integer> [] graph;

public static int[]cats;

public static int vizitat[];
public static int x;
//public static HashMap<String, Integer> map2;

	public static void main (String[] args) throws java.lang.Exception
{

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> contor1= new HashMap<Integer, Integer>();
HashMap<Integer, Integer> contor2= new HashMap<Integer, Integer>();

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();
HashMap<String, Integer> stringuri= new HashMap<String, Integer>();
HashMap<String, Integer> combinari= new HashMap<String, Integer>();

		String a=input.next();
		String b=input.next();
		int com=0;

		int lena=a.length();
		int lenb=b.length();
int y=0;
		for(int i=1;i<=lena & y==0;i++) if(i<=lenb) if(a.charAt(lena-i)==b.charAt(lenb-i)) com++;
		else y=1;

			//System.out.println(com);

			int rez=lena+lenb-2*com;

		System.out.println(rez);

	}

	}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s1 = new StringBuilder(scanner.next()).reverse().toString();
        String s2 = new StringBuilder(scanner.next()).reverse().toString();
        int x = s1.length() + s2.length();
        for (int i = 0; i < Math.min(s1.length(), s2.length()); i++) {
            if (s1.charAt(i) == s2.charAt(i)) {
                x -= 2;
            } else {
                System.out.println(x);
                return;
            }
        }
        System.out.println(x);
    }
}


import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		String t = scan.next();
		int cont = s.length()+t.length();
		int ans = 0;
		int num = 0;

		if(s.length()<t.length()){
			String tmp = s;
			s = t;
			t = tmp;
		}
		while(!s.contains(t)){
			t = t.substring(1);
			ans++;
		}
		num = s.indexOf(t);

		s = s.substring(num);
		//System.out.println(s);
		if(s.equals(t)){
			//System.out.println(t);
			System.out.println(ans+num);
		}else{
			System.out.println(cont);
		}

	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {

		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String s = bf.readLine();
		String t = bf.readLine();
		int cont = s.length()+t.length();
		int ans = 0;
		int num = 0;

		if(s.length()==0 || t.length()==0){
			System.out.println(cont);
			return;
		}

		if(s.length()<t.length()){
			String tmp = s;
			s = t;
			t = tmp;
		}

		while(!s.contains(t)){
			t = t.substring(1);
			ans++;
		}
		num = s.indexOf(t);

		s = s.substring(num);

		if(s.equals(t)){

			System.out.println(ans+num);
		}else{
			System.out.println(cont);
		}

	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {

		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String s = bf.readLine();
		String t = bf.readLine();
		int cont = s.length()+t.length();
		int ans = 0;
		int num = 0;

		if(s.length()<t.length()){
			String tmp = s;
			s = t;
			t = tmp;
		}
		while(!s.contains(t)){
			t = t.substring(1);
			ans++;
		}
		num = s.indexOf(t);

		s = s.substring(num);

		if(s.equals(t)){

			System.out.println(ans+num);
		}else{
			System.out.println(cont);
		}

	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {

		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String s = bf.readLine();
		String t = bf.readLine();
		int a = s.length();
		int b = t.length();
		int cont = a + b;

		int ans = 0;
		int num = 0;

		if(a==0 || b==0){
			System.out.println(cont);
			return;
		}

		if(a<b){
			String tmp = s;
			s = t;
			t = tmp;
		}

		while(!s.contains(t)){
			t = t.substring(1);
			ans++;
		}
		num = s.indexOf(t);

		s = s.substring(num);

		if(s.equals(t)){

			System.out.println(ans+num);
		}else{
			System.out.println(cont);
		}

	}
}


import java.io.*;
import java.util.*;

public class deletefromleft {
	public static void main(String args[]) {
		int flag = 0;
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int i = s.length() - 1, j = t.length() - 1;
		while (true) {
			if (i >= 0 && j >= 0 && s.charAt(i) == t.charAt(j)) {
				++count;
				--i;
				--j;

			} else
				break;

		}
		System.out.println(s.length() + t.length() - 2 * count);

	}
}


import java.io.*;
import java.util.*;

public class deletefromleft {
	public static void main(String args[]) {
		int flag = 0;
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int count = 0;
		int i = s.length() - 1, j = t.length() - 1;
		while (i >= 0 && j >= 0) {
			if (s.charAt(i) == t.charAt(j))
				++count;
			--i;
			--j;

		}
		System.out.println(s.length() + t.length() - 2 * count);

	}
}


import java.io.*;
import java.util.*;

public class deletefromleft {
	public static void main(String args[]) {
		int flag = 0;
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		// System.out.println(s+" "+t);
		int count = 0;
		if (s.length() == t.length()) {
			for (int i = 0; i < s.length(); i++) {
				String str = s.substring(i);
				if (t.substring(i).equals(str)) {
					count = 2 * (s.length() - str.length());
					flag = 1;
					break;
				}
			}
			if (flag == 0)
				count = s.length() + t.length();
		} else if (s.length() > t.length()) {
			for (int i = 0; i < t.length(); i++) {
				String str = t.substring(i);
				int index = s.indexOf(str);
				if (index != -1) {
					if (s.substring(index).equals(str)) {
						count = (index - 1) + (t.length() - str.length()) + 1;
						flag = 1;
						break;
					}

				}
			}
			if (flag == 0)
				count = s.length() + t.length();
		} else {
			for (int i = 0; i < s.length(); i++) {
				String str = s.substring(i);
				int index = t.indexOf(str);
				if (index != -1) {
					if (t.substring(index).equals(str)) {
						count = (index - 1) + (s.length() - str.length()) + 1;
						flag = 1;
						break;
					}

				}
			}
			if (flag == 0)
				count = s.length() + t.length();
		}
		System.out.println(count);
	}
}


import java.util.Scanner;

public class T496 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int len=0;
		for(int i=0;i<s.length();i++){
			if(s.substring(s.length()-i-1).equals(t.substring(t.length()-i-1)))
				len++;
			else
				break;
		}
		System.out.println(s.length()+t.length()-2*len);
	}
}


import java.util.Scanner;

public class T496 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int ss=s.length(),tt=t.length();
		int len=0;
		for(int i=0;i<ss&&i<tt;i++){
			if(s.charAt(ss-1-i)==t.charAt(tt-1-i))
				len++;
			else
				break;
		}
		System.out.println(s.length()+t.length()-2*len);
	}
}


import java.util.Scanner;

public class T496 {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int len=0;
		for(int i=0;i<s.length();i++){
			if(s.charAt(s.length()-1-i)==t.charAt(t.length()-1-i))
				len++;
			else
				break;
		}
		System.out.println(s.length()+t.length()-2*len);
	}
}


// http://codeforces.com/problemset/problem/1005/B

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner read = new Scanner(System.in);

		StringBuilder s = new StringBuilder( read.nextLine() );
		StringBuilder t = new StringBuilder( read.nextLine() );

		int moveCount = 0;

		while (s.length() > t.length()) {
			s.deleteCharAt(0);
			moveCount++;
		}
		while (s.length() < t.length()) {
			t.deleteCharAt(0);
			moveCount++;
		}
		while (s.length() != 0 && !s.toString().equals(t.toString())) {
			s.deleteCharAt(0);
			t.deleteCharAt(0);
			moveCount += 2;
		}

		System.out.println(moveCount);

		// Close scanner
		read.close();
	}

}


// http://codeforces.com/problemset/problem/1005/B

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner read = new Scanner(System.in);

		StringBuilder s = new StringBuilder( read.nextLine() );
		StringBuilder t = new StringBuilder( read.nextLine() );

		int moveCount = 0;
		int sLength = s.length();
		int tLength = t.length();
		int difference = Math.abs(sLength - tLength);

		if (sLength > tLength) {
			s.delete(0, difference);
		}
		else if (sLength < tLength) {
			t.delete(0, difference);
		}

		moveCount += difference;

		while (sLength != 0 && !s.toString().equals(t.toString())) {
			s.deleteCharAt(0);
			t.deleteCharAt(0);
			moveCount += 2;
		}

		System.out.println(moveCount);

		// Close scanner
		read.close();
	}

}


// http://codeforces.com/problemset/problem/1005/B

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner read = new Scanner(System.in);

		String s = read.nextLine();
		String t = read.nextLine();

		int sLength = s.length();
		int tLength = t.length();
		int longestCommonSuffixLength = 0;

		for (int i = sLength-1, j = tLength-1;
			 i >= 0 && j >= 0;
			 --i, --j)
		{
			if (s.charAt(i) == t.charAt(j)) {
				longestCommonSuffixLength++;
			}
			else {
				break;
			}
		}

		int moveCount = (sLength + tLength) - (2 * longestCommonSuffixLength);
		System.out.println(moveCount);

		// Close scanner
		read.close();
	}

}


import java.io.*;
import java.util.*;
import java.math.*;

public class DeleteLeft
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String d1 = s1;
		String s2 = sc.next();
		String d2 = s2;
		int len1 = s1.length();
		int len2 = s2.length();
		int temp; String tem;
		int strike=0;
		//System.out.println(s2.substring(1,len2));
		int j=0;
		for(int i=0; i<len1;)
		{
			strike=i;
			d1 = s1.substring(i, len1);
			d2 = s2.substring(j, len2);
			if(d1.equals(d2))
			{
				System.out.println(++strike);
				return ;
			}
				if(j<len2) {j++; strike++;}
				if(j>=len2) {j=0; i++;}
			//System.out.println(strike);
		}
		System.out.println(len2+len1);

	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class DeleteLeft
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String d1 = s1;
		String s2 = sc.next();
		String d2 = s2;
		int len1 = s1.length();
		int len2 = s2.length();
		int temp; String tem;
	/*	if(len2>len1)
		{
			temp=len2;len2=len1;len1=temp;
			tem=s2;s2=s1;s1=tem;
			tem=d2;d2=d1;d1=tem;
		}  */
		for(int i=0; i<len1; i++)
		{
			d1=s1.substring(i, len1);
			int strike=i, j=0;
		//	System.out.println("d1 :"+d1 + "Strike :"+strike);
			while(j<=len2)
			{
				d2=s2.substring(j, len2);
		//		System.out.println(d2);
				j++;
				if(d1.equals(d2))
				{
					System.out.println(strike);
					return ;
				}
				strike++;
			}
		}
		System.out.println(len1+len2);

	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class DeleteLeft
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		char s1[] = str1.toCharArray();
		String str2 = sc.next();
		char s2[] = str2.toCharArray();
		int len1 = str1.length();
		int len2 = str2.length();
		int temp; String tem;
		int strike=0;
		int i = len1-1, j=len2-1;

		while(i>=0 && j>=0 && s1[i]==s2[j])
		{
			i--;
			j--;
			strike++;
		}
		if(strike==0)
		{
			System.out.println(len2+len1);
		}
		else
		{
			System.out.println((len1+len2)-(2*strike));
		}

	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class DeleteLeft
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String d1 = s1;
		String s2 = sc.next();
		String d2 = s2;
		int len1 = s1.length();
		int len2 = s2.length();
		int temp; String tem;
		int strike=0;
	//	System.out.println(len1+" "+len2);
		if(len2<len1)
		{
			temp=len1;len1=len2;len2=temp;
			tem=s1;s1=s2;s2=tem;
			d1=s1;d2=s2;
		}
	//	System.out.println(len1+" "+len2);
		int j=0;
		if(s1.equals(s2))
		{
			System.out.println(++strike);
			return ;
		}
		for(int i=0; i<len1;)
		{
			strike=i+1;
			d1 = s1.substring(i, len1);
			d2 = s2.substring(j, len2);
			if(d1.equals(d2))
			{
				System.out.println(strike);
				return ;
			}
				if(j<len2) {j++; strike++;}
				if(j>=len2) {j=0; i++;}
		}
		System.out.println(len2+len1);

	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class DeleteLeft
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String d1 = s1;
		String s2 = sc.next();
		String d2 = s2;
		int len1 = s1.length();
		int len2 = s2.length();
		int temp; String tem;
		int strike=0;
		if(len1>len2)
		{
			temp=len1;len1=len2;len2=temp;
			tem=s1;s1=s2;s2=tem;
			d1=s1;d2=s2;
		}
		int j=0;
		if(s1.equals(s2))
		{
			System.out.println("0");
			return ;
		}
		for(int i=0; i<len1;)
		{
			d1 = s1.substring(i, len1);
			d2 = s2.substring(j, len2);
			if(d1.equals(d2))
			{
				System.out.println(strike);
				return ;
			}
			//strike=i;

			if(j<len2) {j++; strike++;}
			if(j>=len2) {j=0; i++; strike=i;}
		//	System.out.println(strike+" "+ d1+" "+d2);
		}
		System.out.println(len2+len1);

	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class deleteFromLeft {
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		String s1=sc.next();
		String s2=sc.next();
		if(s1.equals(s2))
		{
			System.out.println(s1.length()+s2.length());
		}
		else
		{
			int count=0;
			StringBuilder stb1=new StringBuilder(s1);
			StringBuilder stb2=new StringBuilder(s2);
			stb1=stb1.reverse();
			stb2=stb2.reverse();
			int min;
			if(s1.length()<s2.length())
			{
				min=s1.length();
			}
			else
			{
				min=s2.length();
			}

			for(int i=0;i<min;i++)
			{
				if(stb1.charAt(i)==stb2.charAt(i))
				{
					count++;
				}
			}

			int a=s1.length()-count;
			int b=s2.length()-count;
			System.out.println(a+b);
		}

	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class deleteFromLeft {
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();

		String s1=sc.next();
		String s2=sc.next();
		if(!s1.equals(s2))
		{
			StringBuilder stb2=new StringBuilder(s2);
			StringBuilder stb1=new StringBuilder(s1);
			stb2=stb2.reverse();
			stb1=stb1.reverse();
			int min;
			if(s1.length()<s2.length())
			{
				min = s1.length();
			}
			else
			{
				min=s2.length();
			}

			//System.out.println("min:" +min);
			int temp=0;
			for(int i=0;i<=min;i++)
			{
				//System.out.println("stb1:" +stb1.substring(0,i));
				//System.out.println("stb2:" +stb2.substring(0,i));
				if(stb1.substring(0,i).equals(stb2.substring(0,i)))
				{
					temp=i;
					temp++;
					continue;
				}
				else if(!stb1.substring(0,i).equals(stb2.substring(0,i)))
				{
					temp=i;
					//.out.println("tempInside:" +temp);
					break;
				}
			}

			temp--;
			int a=stb1.length()-(temp);
			int b=stb2.length()-(temp);
		//	System.out.println("temp:" +temp);
			System.out.println(a+b);
		}

		if(s1.equals(s2))
		{
			System.out.println(s1.length()+s2.length());
		}

	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class deleteFromLeft {
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();

		String s1=sc.next();
		String s2=sc.next();
		String temp	="";
		if(s1.length()<s2.length())
		{
			temp=s1;
			s1=s2;
			s2=temp;
		}
		int initL=s2.length();
		if(s1.length()!=s2.length())
		{
			while(s2.length()!=s1.length())
			{
				s2='!'+s2;
			}
		}

		int count=0;
		for(int i=s1.length()-1;i>=0;i--)
		{
			if(s1.charAt(i)!=s2.charAt(i))
			{
				break;
			}
			else
			{
				count++;
			}
		}

		int a=s1.length()-count;
		int b=initL-count;
		System.out.println(a+b);

	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class deleteFromLeft {
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		String s1=sc.next();
		String s2=sc.next();
		if(s1.equals(s2))
		{
			System.out.println("0");
		}
		else
		{
			int count=0;
			StringBuilder stb1=new StringBuilder(s1);
			StringBuilder stb2=new StringBuilder(s2);
			stb1=stb1.reverse();
			stb2=stb2.reverse();
			int min;
			if(s1.length()<s2.length())
			{
				min=s1.length();
			}
			else
			{
				min=s2.length();
			}

			for(int i=0;i<min;i++)
			{
				if(stb1.charAt(i)==stb2.charAt(i))
				{
					count++;
				}
				else
				{
					break;
				}
			}

			int a=s1.length()-count;
			int b=s2.length()-count;
			System.out.println(a+b);
		}

	}
}


import java.io.*;
import java.util.*;

public class strings{
	public static void main(String args[]) throws IOException{
		Scanner scan = new Scanner(System.in);
		String str1, str2;
		str1 = scan.next();
		str2 = scan.next();
		int size1 = str1.length()-1;
		int size2 = str2.length()-1;
		while(size1>=0 && size2>=0){
			if(str1.charAt(size1)==str2.charAt(size2)){
				size1--;
				size2--;
			}
			else
				break;
		}
		System.out.println(size1+size2+2);
	}
}


import java.io.*;
import java.util.*;

public class strings{
	public static void main(String args[]) throws IOException{
		Scanner scan = new Scanner(System.in);
		String str1, str2;
		str1 = scan.next();
		str2 = scan.next();
		int size1 = str1.length();
		int size2 = str2.length();
		int temp1 = size1-1;
		int temp2 = size2-1;
		int count = 0;
		while(temp1>=0 && temp2>=0){
			if(str1.charAt(temp1)==str2.charAt(temp2)){
				count++;
			}
			temp1--;
			temp2--;
		}
		System.out.println(size1+size2-(2*count));
	}
}


import java.io.*;
import java.util.*;

public class strings{
	public static void main(String args[]) throws IOException{
		Scanner scan = new Scanner(System.in);
		String str1, str2;
		str1 = scan.next();
		str2 = scan.next();
		int size1 = str1.length()-1;
		int size2 = str2.length()-1;
		while(size1>=0 && size2>=0){
			if(str1.charAt(size1)==str2.charAt(size2)){
				size1--;
				size2--;
			}
		}
		System.out.println(size1+size2+2);
	}
}


import java.io.*;
import java.util.*;

public class strings{
	public static void main(String args[]) throws IOException{
		Scanner scan = new Scanner(System.in);
		String str1, str2;
		str1 = scan.next();
		str2 = scan.next();
		int size1 = str1.length();
		int size2 = str2.length();
		while(size1>=0 && size2>=0){
			if(str1.charAt(size1)==str2.charAt(size2)){
				size1--;
				size2--;
			}
		}
		System.out.println(size1+size2+2);
	}
}


import java.io.*;
import java.util.*;

public class MainClass{

    // static String alp = "abcdefghijklmnopqrstuvwxyz";

    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String s = in.nextLine(),t = in.nextLine();
        int len1 = t.length(), len2 = s.length(), k=1;
        for(int i = len2-k; i>=0; i--){
            for(int j = len1-k; j>=0; j--){
                if(s.charAt(i)==t.charAt(j)){
                    k++;
                }
                else{
                    System.out.print((len1+len2-2)-(k-1)*2);
                    return;
                }
            }
        }
        //System.out.print((len1+len2-2)-(k-1)*2);
    }
}


import java.io.*;
import java.util.*;

public class MainClass{

    // static String alp = "abcdefghijklmnopqrstuvwxyz";

    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String s = in.nextLine(),t = in.nextLine();
        if(s.length()<t.length()){
            String tmp = s;
            s = t;
            t = tmp;
        }
        int len1 = t.length(), len2 = s.length(), k=1;
        for(int i = len2-k; i>=0; i--){
            for(int j = len1-k; j>=0; j--){
                if(s.charAt(i)==t.charAt(j)){
                    k++;
                    break;
                }
                else{
                    System.out.print((len1+len2)-(k-1)*2);
                    return;
                }
            }
        }
        System.out.print((len1+len2)-(k-1)*2);
        //System.out.print((len1+len2-2)-(k-1)*2);
    }
}


import java.io.*;
import java.util.*;

public class MainClass{

    // static String alp = "abcdefghijklmnopqrstuvwxyz";

    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String s = in.nextLine(),t = in.nextLine();
        int len1 = t.length(), len2 = s.length(), k=1;
        for(int i = len2-k; i>=0; i--){
            for(int j = len1-k; j>=0; j--){
                if(s.charAt(i)==t.charAt(j)){
                    k++;
                    break;
                }
                else{
                    System.out.print((len1+len2)-(k-1)*2);
                    return;
                }
            }
        }
        //System.out.print((len1+len2-2)-(k-1)*2);
    }
}


import java.io.*;
import java.util.*;

public class MainClass{

   // static String alp = "abcdefghijklmnopqrstuvwxyz";

    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String s = in.nextLine(),t = in.nextLine();
        int len1 = t.length()+1, len2 = s.length()+1;
        int dp[][] = new int [len1][len2];
        for(int i = 1; i<len1; i++){
            for(int j = 1; j<len2; j++){
                if(t.charAt(i-1)==s.charAt(j-1)) dp[i][j] = dp[i-1][j-1]+1;
                //print(dp[i][j]);
            }
            // println();
        }
        System.out.print((len1+len2-2)-dp[len1-1][len2-1]*2);
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class SuperClassss{

    //ЗАПУСКАЕМ РЕШЕНИЕЕЕЕ
    static class Run{
        static void myMain(){
            String s = nextString(),t = nextString();
            int len1 = t.length()+1, len2 = s.length()+1;
            int dp[][] = new int [len1][len2];
            for(int i = 1; i<len1; i++){
                for(int j = 1; j<len2; j++){
                    if(t.charAt(i-1)==s.charAt(j-1)) dp[i][j] = dp[i-1][j-1]+1;
                    //print(dp[i][j]);
                }
               // println();
            }
            print((len1+len2-2)-dp[len1-1][len2-1]*2);
        }
    }

    public static void main(String[] args) {
        Run.myMain();
        out.flush();
    }

    static Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    static StreamTokenizer in1 = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static BufferedReader in2 = new BufferedReader(new InputStreamReader(System.in));

    //s - подстрока, t - текст
    static int[] prefix_function(String s, String t){
        String edit = s+"#"+t;
        int len = edit.length(), pi[] = new int[len];
        for(int i = 1; i<len; i++){
            int j = pi[i-1];
            while(j>0 && edit.charAt(i)!=edit.charAt(j)) j = pi[j-1];
            if(edit.charAt(i)==edit.charAt(j)) j++;
            pi[i] = j;
        }
        return pi;
    }

    static int[] prefix_function(String edit){
        int len = edit.length(), pi[] = new int[len];
        for(int i = 1; i<len; i++){
            int j = pi[i-1];
            while(j>0 && edit.charAt(i)!=edit.charAt(j)) j = pi[j-1];
            if(edit.charAt(i)==edit.charAt(j)) j++;
            pi[i] = j;
        }
        return pi;
    }

    /**
     * вывод в консоль
     **/
    public static <T> void print(T... args) {
        for (T x : args) {
            out.print(x.toString());
        }
    }

    /**
     * вывод в консоль
     **/
    public static <T> void println(T... args) {
        print(args);
        print("\n");
    }

    /**
     * Чтение числа типа long
     **/
    public static long nextLong() {
        try {
            in1.nextToken();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return (long) in1.nval;
    }

    /**
     * Чтение числа типа int
     **/
    public static int nextInt() {
        try {
            in1.nextToken();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return (int) in1.nval;
    }
    /**
     * Чтение строки
     **/

    static String nextLine(){
        return in.nextLine();
    }
    public static String nextString() {
        try {
            return in2.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * Чтение символа
     **/
    public static char nextChar() {
        try {
            return (char) in2.read();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return '!';
    }

    /**
     * Чтение массива чисел типа int
     **/
    public static void readArray(int[] array) {
        for (int i = 0; i < array.length; i++)
            array[i] = nextInt();
    }

    /**
     * Чтение массива чисел типа long
     **/
    public static void readArray(long[] array) {
        for (int i = 0; i < array.length; i++)
            array[i] = nextInt();
    }

    /**
     * Чтение массива типа char
     **/
    public static void readArray(char[] array) {
        for (int i = 0; i < array.length; i++)
            array[i] = nextChar();
    }

    /**
     * Чтение массива типа String
     **/
    public static void readArray(String[] array) {
        for (int i = 0; i < array.length; i++)
            array[i] = nextString();
    }

    /**
     * Чтение массива типа StringBuilder
     **/
    public static void readArray(StringBuilder[] array) {
        for (int i = 0; i < array.length; i++)
            array[i] = new StringBuilder(nextString());
    }

    /**
     * НОД чисел a и b
     **/
    public static int gcd(int a, int b) {
        while (b != 0) {
            int tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }

    /**
     * НОК чисел a и b
     **/
    public static int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }

    public static int min(int...args){
        Arrays.sort(args);
        return (args[0]);
    }

    public static int max(int...args){
        Arrays.sort(args);
        return(args[args.length-1]);
    }
    /**
     * Возвращает площадь треугольника с вершинами в точках (x1;y1), (x2;y2), (x3;y3)
     **/
    static double s(int x1, int y1, int x2, int y2, int x3, int y3) {
        return Math.abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)) / 2.0;
    }

    /**
     * Возвращает список с простыми числами от 2 до N
     * ---
     * На основе решета Эратосфена
     */
    public static LinkedList<Integer> isPrimeList(int n) {
        LinkedList<Integer> res = new LinkedList<>();
        boolean prime[] = new boolean[n];
        Arrays.fill(prime, true);
        prime[1] = false;
        for (int i = 2; i * i < n; i++) {
            if (prime[i])
                for (int j = i * i; j < n; j += i)
                    prime[j] = false;
        }
        for (int i = 2; i < n; i++)
            if (prime[i]) res.add(i);
        return res;
    }

    /**
     * Вычисляет квадратный корень из длинного числа
     * ---
     * методом Ньютона
     */
    public static BigInteger bigSqrt(BigInteger n) {
        BigInteger a = BigInteger.ONE.shiftLeft((n.bitLength() + 1) / 2), next = a.subtract(BigInteger.ONE);
        while (next.compareTo(a) < 0) {
            a = next;
            next = a.add(n.divide(a)).divide(BigInteger.valueOf(2));
        }
        return a;
    }
}


import java.io.*;
import java.util.*;
 public class Main
{
     public static void main(String args[])
     {
		 Scanner sc=new Scanner(System.in);
          String str1=sc.next();
		  String str2=sc.next();
		  HashMap<String,Integer> hm=new HashMap<>();
		  for(int i=0;i<str1.length();i++)
		  {
			  hm.put(str1.substring(i,str1.length()),1);
		  }long ans=0;
		  for(int i=0;i<str2.length();i++)
		  {
			  if(hm.containsKey(str2.substring(i,str2.length())))
			  {
				  ans=str2.length()-(str2.substring(i)).length();
				  ans+=str1.length()-(str2.substring(i)).length();
				  break;
			  }
		  }
		  if(ans==0)
			  ans=str1.length()+str2.length();
		  System.out.println(ans);
     }
}


import java.io.*;
import java.util.*;
public class Main
{
     public static void main(String args[])
     {
          Scanner sc=new Scanner(System.in);
          String str1=sc.next();
          String str2=sc.next();
          int i=str1.length()-1;
          int j=str2.length()-1;
          while(i>=0&&j>=0)
          {
               if(str1.charAt(i)!=str2.charAt(j))
               {
                    break;
               }
               i--;
               j--;
          }
          System.out.println(i+j+1+1);
     }
}