Олимпиадный тренинг

Задача 32979. alien genome


Задача

Темы:
The genome of the inhabitants of the Tau Ceti system contains 26 types of bases, for which we will use the letters of the Latin alphabet from A to Z, and the genome itself is written
a string of Latin letters. Neighboring base pairs play an important role in the genome, for example, in the ABBACAB genome; the following pairs of bases can be distinguished: AB, BB, BA,
AC, CA, AB. 
The degree of proximity of one genome to another genome is the number of pairs of adjacent bases of the first genome that occur in the second genome.
You are given two genomes, determine the degree of proximity of the first genome to the second genome.

The program receives as input two strings consisting of uppercase Latin letters. Each line is non-empty and its length does not exceed 105.

The program should output a single integer – the degree of closeness of the genome written in the first line to the genome written in the second line.

Enter Output Note
ABBACAB
BCABB
4
The following base pairs of the first genome occur
in the second genome: AB, BB, CA, AB. Note that
that the AB pair occurs twice in the first genome, so
and counted twice in the answer.