Today I saw a problem, put it on the forum for everyone to write, hehe!
Input two lines of strings from the command line, the strings conform to the following format
1 1 3 5
5 3 2 1
All are composed of ten digits from 0-9, each digit is odd, and separated by spaces in the middle. We represent the first group of input as A, the second group as B, and determine how many are the same in each corresponding bit of A and B. The following numbers:
==============
1 2 3 5
1 1 5 5
==============
Among them, there are two groups of correspondences that are the same, namely (1,1) and (5,5). Expressed as 2A, if there is only one group of the same, it is expressed as 1A, three groups of the same are expressed as 3A, and so on.
After comparing the A type (corresponding to the same), then determine whether there are the same numbers in the remaining A and B. One group counts as 1B, two groups count as 2B, and do not compare repeatedly, and so on. The above result is 2A0B. The following are examples:
==================
1 1 2 2
2 2 1 1
0A4B
==================
1 3 3 3
3 1 1 1
0A2B
==================
1 2 3 4
4 3 2 1
0A4B
==================
1 1 1 1
1 1 1 1
4A0B
==================
1 3 5 6
2 3 5 9
2A0B
==================
Just output the result nAmB
Input two lines of strings from the command line, the strings conform to the following format
1 1 3 5
5 3 2 1
All are composed of ten digits from 0-9, each digit is odd, and separated by spaces in the middle. We represent the first group of input as A, the second group as B, and determine how many are the same in each corresponding bit of A and B. The following numbers:
==============
1 2 3 5
1 1 5 5
==============
Among them, there are two groups of correspondences that are the same, namely (1,1) and (5,5). Expressed as 2A, if there is only one group of the same, it is expressed as 1A, three groups of the same are expressed as 3A, and so on.
After comparing the A type (corresponding to the same), then determine whether there are the same numbers in the remaining A and B. One group counts as 1B, two groups count as 2B, and do not compare repeatedly, and so on. The above result is 2A0B. The following are examples:
==================
1 1 2 2
2 2 1 1
0A4B
==================
1 3 3 3
3 1 1 1
0A2B
==================
1 2 3 4
4 3 2 1
0A4B
==================
1 1 1 1
1 1 1 1
4A0B
==================
1 3 5 6
2 3 5 9
2A0B
==================
Just output the result nAmB


