event that |a|>0 (the length of the string an is more prominent than nothing), erase the principal character of the string a, that is, supplant a with a2a3… an; in the event that |a|>0, erase the last character of the string a, that is, supplant a with a1a2… an−1; if |b|>0 (the length of the string b is more prominent than nothing), erase the main character of
Correct answer will be upvoted else downvoted. Computer science.
in the event that |a|>0 (the length of the string an is more prominent than nothing), erase the principal character of the string a, that is, supplant a with a2a3… an;
in the event that |a|>0, erase the last character of the string a, that is, supplant a with a1a2… an−1;
if |b|>0 (the length of the string b is more prominent than nothing), erase the main character of the string b, that is, supplant b with b2b3… bn;
in the event that |b|>0, erase the last character of the string b, that is, supplant b with b1b2… bn−1.
Note that after every one of the tasks, the string an or b might become vacant.
For instance, in the event that a="hello" and b="icpc", you can apply the accompanying grouping of tasks:
erase the principal character of the string a ⇒ a="ello" and b="icpc";
erase the primary character of the string b ⇒ a="ello" and b="cpc";
erase the principal character of the string b ⇒ a="ello" and b="pc";
erase the last character of the string a ⇒ a="ell" and b="pc";
erase the last character of the string b ⇒ a="ell" and b="p".
For the given strings an and b, track down the base number of activities for which you can make the strings an and b equivalent. Note that vacant strings are additionally equivalent.
Input
The principal line contains a solitary integer t (1≤t≤100). Then, at that point, t experiments follow.
The principal line of each experiment contains the string a (1≤|a|≤20), comprising of lowercase Latin letters.
The second line of each experiment contains the string b (1≤|b|≤20), comprising of lowercase Latin letters.
Output
For each experiment, output the base number of activities that can make the strings an and b equivalent.
Step by step
Solved in 3 steps with 1 images