-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcdfq2.cpp
More file actions
42 lines (37 loc) · 851 Bytes
/
Copy pathcdfq2.cpp
File metadata and controls
42 lines (37 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
int main()
{
int samples;
cin >> samples;
while (samples--)
{
string str;
cin >> str;
string str1;
cin >> str1;
str = str + str1;
sort(str.begin(), str.end());
if (str[0] == str[1] && str[2] == str[3] && str[2] == str[1])
{
cout << "0" << endl;
}
else if (str[2] == str[1] && (str[1] == str[0] || str[1] == str[3]))
{
cout << "1" << endl;
}
else if (str[1] == str[0] && str[2] == str[3])
{
cout << "1" << endl;
}
else if (str[1] == str[0] || str[2] == str[3] || str[1] == str[2])
{
cout << "2" << endl;
}
else
{
cout << "3" << endl;
}
}
return 0;
}