0132. String

Input file name: string.in
Output file name: string.out
Time limit: 500 ms
Memory limit: 64 megabytes

Find the number of string S in the lexicographically ordered set of strings composed of the same set of letters.

Input file

The only line contains the string S, composed of not more than 32 lowercase Italian characters.

Output file

Output the number required.

Examples:

string.instring.out
abba3
baba5


Source: Petrozavodsk Summer 2003. Blitz Kontest, Monday, August 25
Author: Andrew Lopatin, Nick Durov

Discuss       Submit a solution



Printable version