CF991E.Bus Number

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the losestreak only grew longer and longer... It's no wonder he didn't get any sleep this night at all.

In the morning, Vasya was waiting the bus to the university on the bus stop. Vasya's thoughts were hazy and so he couldn't remember the right bus' number quite right and got onto the bus with the number nn .

In the bus, Vasya thought that he could get the order of the digits in the number of the bus wrong. Futhermore, he could "see" some digits several times, but the digits he saw were definitely in the real number of the bus. For example, if Vasya saw the number 2028, it could mean that the real bus number could be 2028, 8022, 2820 or just 820. However, numbers 80, 22208, 52 definitely couldn't be the number of the bus. Also, real bus number couldn't start with the digit 0, this meaning that, for example, number 082 couldn't be the real bus number too.

Given nn , determine the total number of possible bus number variants.

输入格式

The first line contains one integer nn ( 1n10181 \leq n \leq 10^{18} ) — the number of the bus that was seen by Vasya. It is guaranteed that this number does not start with 00 .

输出格式

Output a single integer — the amount of possible variants of the real bus number.

输入输出样例

  • 输入#1

    97
    

    输出#1

    2
    
  • 输入#2

    2028
    

    输出#2

    13
    

说明/提示

In the first sample, only variants 9797 and 7979 are possible.

In the second sample, the variants (in the increasing order) are the following: 208208 , 280280 , 802802 , 820820 , 20282028 , 20822082 , 22082208 , 22802280 , 28022802 , 28202820 , 80228022 , 82028202 , 82208220 .

首页