hdu 1544 水题

时间:2023-07-11 22:27:06
hdu 1544 水题

  水题

/*
* Author : ben
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <functional>
#include <numeric>
#include <cctype>
using namespace std;
const int MAX_LEN = ;
char str[MAX_LEN];
int work() {
int len = strlen(str);
int ret = , j, k;
for(int i = ; i < len; i++) {
j = i;
while(j >= ) {
k = * i - j;
if(k >= len || str[j] != str[k]) {
break;
}
ret++;
j--;
}
}
for(int i = ; i < len; i++) {
j = i - ;
if(str[j] != str[i]) {
continue;
}
while(j >= ) {
k = * i - - j;
if(k >= len || str[j] != str[k]) {
break;
}
ret++;
j--;
}
}
return ret;
} int main() {
while(scanf("%s", str) == ) {
printf("%d\n", work());
}
return ;
}