#include <stdio.h>
int countIntersections(char s[]) {
int intersections = 0;
// Duyệt qua mỗi kí tự trong xâu
for (int i = 0; i < 52; i += 2) {
// Duyệt qua các kí tự còn lại
for (int j = i + 2; j < 52; j += 2) {
// Kiểm tra xem các đoạn thẳng có cắt nhau không
if (s[i] == s[j] || s[i] == s[j + 1] || s[i + 1] == s[j] || s[i + 1] == s[j + 1]) {
intersections++;
}
}
}
return intersections;
}
int main() {
char s[53];
int result = countIntersections(s);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgY291bnRJbnRlcnNlY3Rpb25zKGNoYXIgc1tdKSB7CiAgICBpbnQgaW50ZXJzZWN0aW9ucyA9IDA7CgogICAgLy8gRHV54buHdCBxdWEgbeG7l2kga8OtIHThu7EgdHJvbmcgeMOidQogICAgZm9yIChpbnQgaSA9IDA7IGkgPCA1MjsgaSArPSAyKSB7CiAgICAgICAgLy8gRHV54buHdCBxdWEgY8OhYyBrw60gdOG7sSBjw7JuIGzhuqFpCiAgICAgICAgZm9yIChpbnQgaiA9IGkgKyAyOyBqIDwgNTI7IGogKz0gMikgewogICAgICAgICAgICAvLyBLaeG7g20gdHJhIHhlbSBjw6FjIMSRb+G6oW4gdGjhurNuZyBjw7MgY+G6r3QgbmhhdSBraMO0bmcKICAgICAgICAgICAgaWYgKHNbaV0gPT0gc1tqXSB8fCBzW2ldID09IHNbaiArIDFdIHx8IHNbaSArIDFdID09IHNbal0gfHwgc1tpICsgMV0gPT0gc1tqICsgMV0pIHsKICAgICAgICAgICAgICAgIGludGVyc2VjdGlvbnMrKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICByZXR1cm4gaW50ZXJzZWN0aW9uczsKfQoKaW50IG1haW4oKSB7CiAgICBjaGFyIHNbNTNdOwogICAgc2NhbmYoIiVzIiwgcyk7CgogICAgaW50IHJlc3VsdCA9IGNvdW50SW50ZXJzZWN0aW9ucyhzKTsKICAgIAogICAgcHJpbnRmKCIlZFxuIiwgcmVzdWx0KTsKCiAgICByZXR1cm4gMDsKfQo=