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 = '# coding: utf-8\n# Your code here!\nimport sys\nreadline = sys.stdin.readline\nread = sys.stdin.read\n\ndef solve():\n    s = input()\n    n = len(s)\n    if all(s[0] == k for k in s):\n        return 1\n    \n    somesame = 0\n    for j in range(n-1):\n        if s[j] == s[j+1]:\n            somesame = 1\n            break\n\n    x = [(ord(i)-1)%3 for i in s]\n    v = sum(x)%3\n\n    if n==2: return 2\n    if n==3:\n        if v==0: return 3\n        if somesame==0:\n            return 7\n        else:\n            return 6\n    \n    dp = [[1,0,0],[0,1,0],[0,0,1]]\n    for _ in range(n-1):\n        ndp = [[0]*3 for i in range(3)]\n        for i in range(3):\n            for j in range(3):\n                for k in range(3):\n                    if k == j: continue\n                    ndp[(i+k)%3][k] += dp[i][j]\n                    ndp[(i+k)%3][k] %= MOD\n        dp = ndp    \n        #for c in dp:\n        #    print(3**(_+1) - sum(c), end = " ")\n        #print(dp)\n        \n    c = pow(3,n-1,MOD)    \n    c -= sum(dp[v])\n    if somesame==0:\n        c += 1\n    return c%MOD\n        \n\n        \nMOD = 998244353    \nprint(solve())\n\n\n\n"""\ndef check(n):\n    from itertools import product\n    res = 0\n    for a in product(range(3),repeat=n):\n        for j in range(n-1):\n            if a[j] == a[j+1]: break\n        else:\n            continue\n        #print(a)\n        if sum(a)%3==0:\n            res += 1\n    print(res)\n\n\n\ndef check2(a):\n    n = len(a)\n    s = set()\n    s.add(tuple(a))\n    from random import randrange\n    for _ in range(2000):\n        co = a[:]\n        for k in range(1000):\n            i = randrange(0,n-1)\n            if co[i] != co[i+1]:\n                co[i] = co[i+1] = 2*(co[i]+co[i+1])%3\n            s.add(tuple(co))\n            if all(co[0] == k for k in co): break\n    print(a)\n    print(len(s),s)            \n\n\n            \ncheck(5)\n#check2([0,1,2,0,1,2])\n\n\n"""'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14317