Codeforces Beta Round 47
B
Choosing Symbol Pairs
Codeforces
1500
原题
← AC →
翻译中…

There is a given string $*S*$ consisting of $*N*$ symbols. Your task is to find the number of ordered pairs of integers $*i*$ and $*j*$ such that

翻译中…
  1. $1 ≤ *i*, *j* ≤ *N*$
翻译中…
  1. $*S*[*i*] = *S*[*j*]$, that is the $*i*$-th symbol of string $*S*$ is equal to the $*j*$-th.
翻译中…

Input

翻译中…

The single input line contains $*S*$, consisting of lowercase Latin letters and digits. It is guaranteed that string $*S*$ in not empty and its length does not exceed $10^{5}$.

翻译中…

Output

翻译中…

Print a single number which represents the number of pairs $*i*$ and $*j*$ with the needed property. Pairs $(*x*, *y*)$ and $(*y*, *x*)$ should be considered different, i.e. the ordered pairs count.

翻译中…

样例

Input #1
great10
Output #1
7
InputCopy OutputCopy
Input #2
aaaaaaaaaa
Output #2
100
InputCopy OutputCopy
题目信息
题号
50B
时间限制
2 s
内存限制
256 MB
标签
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。