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 = "s = list(input())\n\nn = len(s)\n\na = [0] * n\n\nMOD = 998244353\n\nfor i in range(n):\n    a[i] = ord(s[i]) - ord('a')\n\nif max(a) == min(a):\n    print((1))\n    return\nelif n == 3:\n    def solver(m):\n        x = m // 100\n        y = ( m % 100 ) // 10\n        z = m % 10\n        if x != y:\n            c = (3 - x - y) % 3\n            temp = c * 110 + z\n            if temp not in ans:\n                ans.add(temp)\n                solver(temp)\n        if y != z:\n            c = (3 - y - z) % 3\n            temp = x * 100 + c * 11\n            if temp not in ans:\n                ans.add(temp)\n                solver(temp)\n\n    t = a[0] * 100 + a[1] * 10 + a[2]\n    ans = set()\n    ans.add(t)\n    solver(t)\n    print((len(ans)))\n    return\nelif n == 2:\n    print((2))\n    return\n\ndp = [[0,0,0] for _ in range(3)]\n\ndp[0][0] = 1\ndp[1][1] = 1\ndp[2][2] = 1\n\nfor i in range(n-1):\n    T = [[0,0,0] for _ in range(3)]\n    T[0][0] = (dp[1][0] + dp[2][0]) % MOD\n    T[0][1] = (dp[1][1] + dp[2][1]) % MOD\n    T[0][2] = (dp[1][2] + dp[2][2]) % MOD\n    T[1][0] = (dp[0][2] + dp[2][2]) % MOD\n    T[1][1] = (dp[0][0] + dp[2][0]) % MOD\n    T[1][2] = (dp[0][1] + dp[2][1]) % MOD\n    T[2][0] = (dp[0][1] + dp[1][1]) % MOD\n    T[2][1] = (dp[0][2] + dp[1][2]) % MOD\n    T[2][2] = (dp[0][0] + dp[1][0]) % MOD\n    dp, T = T, dp\n\nm = sum(a) % 3\n\nans = 3 ** (n-1) - (dp[0][m] + dp[1][m] + dp[2][m])\n\ncheck = 1\nfor i in range(n-1):\n    if a[i] == a[i+1]:\n        check = 0\n        break\n\nans += check\n\n#print(dp, 2 ** (n-1))\n\nprint((ans % MOD))\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: