Time

10:43:07
11 Feb 2012
ACM-ICPC Thailand Southern Region Programming Contest 2011
Left: 4 hours 17 minutes
End: 11.02.2012 15:00
Leader: Informatimukas
Five for week 22
Left: 11 hours 17 minutes
End: 11.02.2012 22:00
Leader: NuM
Version for print

Degree of symmetry

prb19   For a natural number let's define the degree of symmetry as an amount of pairs of its decimal digits, whose digits are equal and stand symmetrically with respect to the center of the number's decimal notation. If some digit stands in the center of the decimal notation, then it must be accepted too, as in pair with itself. Find the degree of symmetry of a given number N.


Specifications

   Input

   The natural number N (N < 2·109).

   Output

   One number – the degree of symmetry of N.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 10
Complexity: 11% 860/966

Example

Example input

123322
55555

Example output

2
3


← Paint2D Problems How many times to repeat? →