atcoder#ARC094D. [ARC094F] Normalization
[ARC094F] Normalization
Score : points
Problem Statement
You are given a string consisting of a
,b
and c
. Find the number of strings that can be possibly obtained by repeatedly performing the following operation zero or more times, modulo :
- Choose an integer such that and the -th and -th characters in are different. Replace each of the -th and -th characters in with the character that differs from both of them (among
a
,b
andc
).
Constraints
- consists of
a
,b
andc
.
Input
Input is given from Standard Input in the following format:
Output
Print the number of strings that can be possibly obtained by repeatedly performing the operation, modulo .
abc
3
abc
, aaa
and ccc
can be obtained.
abbac
65
babacabac
6310
ababacbcacbacacbcbbcbbacbaccacbacbacba
148010497