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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.

 

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education