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 itertools\n\nS = input()\nN = len(S)\nif all(S[0] == c for c in S):\n    print((1))\n    return\nif N == 2:\n    print((1 if S[0]==S[1] else 2))\n    return\n\nif N == 3:\n    def another(a,b):\n        s = set('abc')\n        s -= set([a,b])\n        return list(s)[0]\n    ptn = set()\n    stack = [S]\n    while stack:\n        a = stack.pop()\n        ptn.add(a)\n        if a[0] != a[1]:\n            b = another(a[0],a[1])*2 + a[2]\n            if not b in ptn:\n                stack.append(b)\n        if a[1] != a[2]:\n            c = a[0] + another(a[1],a[2])*2\n            if not c in ptn:\n                stack.append(c)\n    print((len(ptn)))\n    return\n\n#N >= 4\nMOD = 998244353\ndp = [[[0 for u in range(2)] for l in range(3)] for s in range(3)]\n#dp[sum%3][last][exist'xx'?]\nfor ptn in itertools.product(list(range(3)),repeat=4):\n    seq = (ptn[0]==ptn[1] or ptn[1]==ptn[2] or ptn[2]==ptn[3])\n    dp[sum(ptn)%3][ptn[3]][seq] += 1\n\nfor n in range(4,N):\n    dp2 = [[[0 for u in range(2)] for l in range(3)] for s in range(3)]\n    for s in range(3):\n        for l in range(3):\n            for u in range(2):\n                for l2 in range(3):\n                    s2 = (s+l2)%3\n                    u2 = u or l==l2\n                    dp2[s2][l2][u2] += dp[s][l][u]\n                    dp2[s2][l2][u2] %= MOD\n    dp = dp2\n\nsm = 0\nfor c in S:\n    sm += ord(c) - ord('a')\nseq = False\nfor c1,c2 in zip(S,S[1:]):\n    if c1 == c2:\n        seq = True\n        break\nans = sum([dp[sm%3][i][1] for i in range(3)])\nif not seq: ans += 1\nprint((ans % MOD))\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: