cswork / OAOpen practice workspace

SalesforceOA #36

Replace '?' to Avoid Adjacent Duplicates

Estimated MediumJudge-ready

Topics (AI-labelled)DP BasicsBits & Math

The string consists of lowercase letters and question marks; each question mark may be replaced with any lowercase letter, and fixed letters cannot be changed. Find the number of replacements after which no two adjacent characters are equal, modulo 1000000007.

Input

One line containing s. Full original bounds: 1≤|s|≤100000, and the characters are only a..z or ?.

Output

Output one integer answer.

Example 1

Input:

??

Output:

650

Example 2

Input:

a?a

Output:

25

Example 3

Input:

aa

Output:

0

Example notes

The outputs of the three public examples are, in order: 650; 25; 0. They have been checked by independent enumeration or direct simulation.

Editorial

Loading solution…