Cod sursa(job #2092492)
| Utilizator | Data | 21 decembrie 2017 19:56:26 | |
|---|---|---|---|
| Problema | PScPld | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("pscpld.in");
ofstream g("pscpld.out");
const int NMax=1000000;
int c;
char a[NMax+5];
int check(int i,int j)
{
while(i<j)
{
if(a[i]!=a[j]) return 0;
i++;j--;
}
return 1;
}
int main()
{
f.getline(a,NMax+5);
c=strlen(a);
for(int i=0;i<strlen(a);i++)
for(int j=i+1;j<=strlen(a);j++)
if(a[i]==a[j]&&check(i,j)) c++;
g<<c;
return 0;
}
