-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCC-CHEFSHIP.cpp
More file actions
46 lines (44 loc) · 1.1 KB
/
CC-CHEFSHIP.cpp
File metadata and controls
46 lines (44 loc) · 1.1 KB
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
43
44
45
46
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define nl "\n"
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(x) int x; cin>>x; while(x--)
void shammi() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int main() {
shammi();
w(t) {
string S; cin >> S;
ll n = S.length(), count = 0;
// ll first = 0;
if (n % 2) {
cout << 0 << nl;
continue;
}
for (ll len = 1; len < n / 2 ; len++) {
string a = S.substr(0, len);
string b = S.substr(len, len);
string c = S.substr(2 * len, (n / 2) - len);
string d = S.substr(2 * len + (n / 2) - len, (n / 2) - len);
// cout << a << " " << b << " " << c << " " << d << nl;
if (a == b && c == d) {
count++;
}
// len++;
}
cout << count << nl;
// cout << first << nl;
}
return 0;
}