You are given a string S 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 998244353:
 - Choose an integer i such that 1\leq i\leq |S|-1 and the i-th and (i+1)-th characters in S are different. Replace each of the i-th and (i+1)-th characters in S with the character that differs from both of them (among a, b and c).

-----Constraints-----
 - 2 \leq |S| \leq 2 × 10^5
 - S consists of a, b and c.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
Print the number of strings that can be possibly obtained by repeatedly performing the operation, modulo 998244353.

-----Sample Input-----
abc

-----Sample Output-----
3

abc, aaa and ccc can be obtained.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "import sys\ninput = sys.stdin.readline\n\nimport numpy as np\n\nMOD = 998244353\n\nS = input().rstrip()\n\narr = np.array(list(S.replace('a','0').replace('b','1').replace('c','2')),dtype=np.int32)\n\nif (arr == arr[0]).all():\n    print(1)\n    return\n\ndef solve_naive(S):\n    se = set([S])\n    q = [S]\n    while q:\n        S = q.pop()\n        for i in range(len(S)-1):\n            x,y = S[i:i+2]\n            if x == y:\n                continue\n            for t in 'abc':\n                if t != x and t != y:\n                    T = S[:i] + t+t + S[i+2:]\n                    if T not in se:\n                        q.append(T)\n                        se.add(T)\n    return len(se)\n\nLS = len(S)\nif LS < 6:\n    answer = solve_naive(S)\n    print(answer)\n    return\n\n# 適当な必要条件のもと全部作れる\n# mod 3不変量\nanswer = pow(3,LS-1,MOD)\n# 同一値の連続が存在しないものを間引く\nif LS%3 == 0:\n    x,y = (3+MOD)//2,0\n    for _ in range(LS//3):\n        x,y = 4*x+4*y,2*x+6*y\n        x %= MOD\n        y %= MOD\n    if arr.sum()%3 == 0:\n        answer -= x\n    else:\n        answer -= y\nelse:\n    answer -= pow(2,LS-1,MOD)\n# 初手に完成しているやつは使って良い\nif (arr[:-1] != arr[1:]).all():\n    answer += 1\n\nanswer %= MOD\nprint(answer)"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: