Pagini recente » Cod sursa (job #2160584) | Cod sursa (job #2048140) | Cod sursa (job #2909087) | Cod sursa (job #2308195) | Cod sursa (job #2942043)
#include <fstream>
#include <algorithm>
using namespace std;
ifstream cin("pscpld.in");
ofstream cout("pscpld.out");
int t[2000001];
signed main() {
string s;
char ch;
int i, drmax, curCenter, lung, rez;
drmax = 0;
curCenter = 0;
while(cin>>ch) {
s = s + '#' + ch;
}
s = s + '#';
lung = s.size() - 1;
/*for (i = 1; i <= lung; i++) {
if (i <= curCenter + t[curCenter]) {
t[i] = min(t[2 * curCenter - i], curCenter + t[curCenter] - i);
}
else {
t[0] = 0;
}
while (i + t[i] + 1 <= lung && i - t[i] - 1 >= 0 && s[i - t[i] - 1] == s[i + t[i] + 1]) {
t[i]++;
}
if (i + t[i] > curCenter + t[curCenter]) {
curCenter = i;
}
}
rez = 0;
for (i = 1; i <= lung; i++) {
if (i % 2 == 1) {
rez = rez + t[i] / 2 + 1;
}
else {
rez = rez + t[i] / 2;
}
}*/
cout << rez;
return 0;
}