Computer Engineering lab
Extracted text: Question} Using python solve the below problem: How to measure the difference between two strings? This is a midnight question of biological scientists. The number of pairs of different characters in the same position may be a good indicator. However, it will not work well in the case when two strings have different lengths. The longest common subsequence will also fail when strings are too long. Recently, Professor of Math L.P.C. has invented the special method to deal with this problem. His invention has been known as a simple but creative solution: the difference is based on the number of substrings (a non-empty group of consecutive characters) of one string that are not substrings of the other string. Let's learn about his invention. Call the first string as A and the second string as B. Let Ş be the set of all different substrings of A, and T be the set of all different substrings of B. We then define another set P which consists of all the strings that belongs to S or T, but not both. According to the Professor L.P.C. method, the size of P is a good indicator to measure the difference between A and B For example, let A = aacd and B = cdaa. We can see that: %3D S= {a, aa, aac, aacd, ac, acd, c, cd, d}, T= {c, cd, cda, cdaa, d, da, daa, a, aa}, P = {aac, aacd, ac, acd, cda, cdaa, da, daa}. Size of P is 8 and we can say the level of difference between A and B is 8. Your task is to find this indicator. Find a pythonic approach for the solution and develop an optimized python code. Sample inputs outputs are listed below: Input: aacd cdaa Output: 8