Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Choosing Symbol Pairs

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThere 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*

2. *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.

Examples

Input

great10

Output

7

Input

aaaaaaaaaa

Output

100

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/17/2018 07:13:00 (d2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|