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 = "from collections import defaultdict\nimport sys\nS=input()\nN=len(S)\nif N==3:\n    if S[0]==S[1]:\n        if S[1]==S[2]:\n            print((1))\n        else:\n            print((6))\n    else:\n        if S[0]==S[2]:\n            print((7))\n        elif S[1]==S[2]:\n            print((6))\n        else:\n            print((3))\n    return\na=S[0]\nt=1\nfor i in range(N):\n    if S[i]!=a:\n        t=0\n        break\nif t==1:\n    print((1))\n    return\n\nmod=998244353\nM=0\nfor s in S:\n    if s=='b':\n        M+=1\n    elif s=='c':\n        M+=2\n    M%=3\ndp=[]\nfor i in range(2):\n    for k in range(3):\n        for l in range(3):\n            dp.append((i,k,l))\ndd=[[[0]*3 for i in range(3)] for i in range(2)]\nfor i in range(3):\n    dd[0][i][i]=1\nfor k in range(2,N+1):\n    nd=[[[0]*3 for i in range(3)] for i in range(2)]\n    for p in dp:\n        con,moji,m=p\n        n=dd[con][moji][m]\n        #print(con,moji,m)\n        if con==0:\n            for k in range(3):\n                if moji==k:\n                    nd[1][k][ (m + k) % 3] += n\n                    nd[1] [k ][(m + k) % 3] %=mod\n                else:\n                    nd[0][k][(m+k)%3]+=n\n                    nd[0][ k] [(m+k) % 3] %=mod\n        else:\n            for k in range(3):\n                nd[1][k][(m + k) % 3] += n\n                nd[1][k][(m + k) % 3] %=mod\n    #print(nd)\n    dd=nd\nflag=1\nfor i in range(N-1):\n    if S[i]==S[i+1]:\n        flag=0\nans=flag\nfor k in range(3):\n    ans+=dd[1][k][M]\n    ans%=mod\nprint(ans)\n\n\n\n\n"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: