#2. Substring and subsequence

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: syzoj

题目描述

You are given a long string S with only character a , b and c , please find the answer to the following two questions.

  1. How many substrings that have all three kinds of characters?

  2. How many sequences that have all three kinds of characters?

The answer could be very large, please modulo by 998244353 .

输入格式

The input has only two lines. The first line, a number n , the number of character in the string. The second line, string S .

输出格式

Output 2 lines.

The first line, the answer of question 1 .

The second line, the answer of question 2 .

样例

Sample Input

4
abcc

Sample Output

2
3

数据范围与提示

1 \leq |S| \leq 3 \cdot 10^5