SOLVE

LATER

Palindrome Codiyapa

Problem

Editorial

Analytics

People curse **Garg** for always having **Suffix Array** in his problem set.

Having thought upon this for some time, he decided that he will not have this topic again this time.

But as his love for **STRINGS** never actually ceases to exist, he decided once again to play with strings.

He provides you two strings **X** and **Y**.

You need to **divide both strings into K parts** as per the following rules-

- The two strings can now be represented as
**X**respectively._{1}X_{2}X_{3}...X_{K}and Y_{1}Y_{2}Y_{3}...Y_{K} - Any of the
**X**can be_{i}or Y_{i}**NULL.** **X**has to be necessarily_{i}Y_{i}**PALINDROME**for**all i in [1,K ]**.

*K should be as small as possible.*

Since Garg has to make output files as soon as possible in order to meet his girlfriend, help him by providing the minimum valid value of K.

**Input**

The first line of the input contains an integer **T - denoting the number of the test cases.**

Each test case will be consisting of **two lines containing string X and Y respectively .**

**Output**

For each test case, an integer which will denote the **value of K is output on a separate line.**

**Constraints**

**1<=T<=5**

**1<=|X|,|Y|<=80**, where **|X| and |Y| denote lengths of X and Y respectively.**

X and Y comprise only lower case characters

Problem Setter:- Shivam Garg

Explanation

In the first case -

**X _{1} = a , X_{2} = b , X_{3} = c , X_{4} = NULL**

In the second case -

**X _{1} = ab , X_{2} = xy**

Y_{1} = ba , Y_{2} = yx

Time Limit:
2.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"19e0df5": "/pagelets/problems-hint/algorithm/palindrome-codiyapa/", "0c9c0e9": "/pagelets/problem-author-tester/algorithm/palindrome-codiyapa/", "22c3836": "/pagelets/suggested-problems/algorithm/palindrome-codiyapa/", "58cbe3e": "/pagelets/show-submission/algorithm/palindrome-codiyapa/", "4d569b4": "/pagelets/recommended-problems/algorithm/palindrome-codiyapa/"}

realtime.hackerearth.com

80

14e8ea5a33d6204a96a9aebd62f1b966047f16e0

58a29e5cae2309f04b28

/realtime/pusher/auth/