Anjali and Tasty Treat

All submissions for this problem are available.
Anjali loves food and she loves to cook. With time, she has mastered the art of transforming a cooked dish into another one. A dish can be represented as a string, where the ingredients are denoted by upper case English alphabets, and the order of ingredients does matter. She has already cooked a dish $A$ which she wants to transform to another dish $B$. There are three types operations which she can perform any number of times (including $0$) and in any order on dish $A$ to make dish $B$:  Drop an ingredient free of cost.  Add an ingredient at the end with unit cost.  Swap a pair of ingredients free of cost. Can you help her determine the minimum possible cost to make dish $B$ from her dish $A$? ### Input:  The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.  The first line of each test case contains the string $A$.  The second line contains the string $B$. ### Output: For each test case print a single line containing an integer denoting the minimum possible cost to cook dish $B$ from dish $A$. ### Constraints:  $1 \leq T \leq 10$  $1 \leq A, B \leq 10^{5}$ ($A$ denotes the length of string $A$)  Both the strings contain only upper case English alphabets ### Subtasks:  **10 points:** $1 \leq A, B \leq 10^{3}$  **90 points:** original constraints ### Sample Input: 1 ABC ABCCD ### Sample Output: 2 ### Explanation:  **Example Case 1:** She can first add the ingredient ```'C'``` at the end with unit cost, and then she can add the ingredient ```'D'``` at the end with unit cost. Since the ordering of ingredients of $A$ matches with that of $B$ after these two operations, there is no need to perform any other operation. Hence, $2$ is the minimum possible cost.Author:  ankushkhanna 
Editorial  https://discuss.codechef.com/problems/DWW19C 
Tags  ankushkhanna, ankushkhanna, dwwu2019, easy, greedy, observations 
Date Added:  28122019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 