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
#include "palindromy.h"
#include "message.h"

#include <algorithm>
#include <iostream>

using namespace std;

int main() {

  long long N = GetLength();
  
  long long res = 0;
  if (MyNodeId() == 0){
  	for (int i = 0; i < N; ++i) {
	    for (int j=0; j<=1; j++){
	    	int left = i;
	    	int right = i + j;

	    	while (left >=0 && right < N){
	    		if (GetLetter(left) == GetLetter(right)){
	    			++res;
	    		} else {
	    			break;
	    		}
	    		left--;
	    		right++;
	    	}
	    }
  	}
 
    cout << res << endl;
  }
  
  return 0;
}