output_description: Print the number of different strings you can obtain by reversing any
  substring in A at most once.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A
attempt: import sys, collections as cl, bisect as bs
  
  sys.setrecursionlimit(100000)
  input = sys.stdin.readline
  mod = 10**9 + 7
  Max = sys.maxsize
  
  
  def l():  # intのlist
      return list(map(int, input().split()))
  
  
  def m():  # 複数文字
      return map(int, input().split())
  
  
  def onem():  # Nとかの取得
      return int(input())
  
  
  def s(x):  # 圧縮
      a = []
      if len(x) == 0:
          return []
      aa = x[0]
      su = 1
      for i in range(len(x) - 1):
          if aa != x[i + 1]:
              a.append([aa, su])
              aa = x[i + 1]
              su = 1
          else:
              su += 1
      a.append([aa, su])
      return a
  
  
  def jo(x):  # listをスペースごとに分ける
      return " ".join(map(str, x))
  
  
  def max2(x):  # 他のときもどうように作成可能
      return max(map(max, x))
  
  
  def In(x, a):  # aがリスト(sorted)
      k = bs.bisect_left(a, x)
      if k != len(a) and a[k] == x:
          return True
      else:
          return False
  
  
  def pow_k(x, n):
      ans = 1
      while n:
          if n % 2:
              ans *= x
          x *= x
          n >>= 1
      return ans
  
  
  """
  def nibu(x,n,r):
      ll = 0
      rr = r
      while True:
          mid = (ll+rr)//2
  
      if rr == mid:
          return ll
      if (ここに評価入れる):
          rr = mid
      else:
          ll = mid+1
  """
  
  a = input()[:-1]
  
  su = (len(a) * (len(a) - 1)) // 2
  
  po = [0 for i in range(26)]
  
  for i in range(len(a)):
      on = ord(a[i]) - 97
      su -= po[on]
      po[on] += 1
  print(su + 1)
  
problem_description: Statement
  
  You have a string A = A_1 A_2 ... A_n consisting of lowercase English letters.
  
  You can choose any two indices i and j such that 1 \leq i \leq j \leq n and
  reverse substring A_i A_{i+1} ... A_j.
  
  You can perform this operation at most once.
  
  How many different strings can you obtain?
samples: [{"input": "aatt", "output": "5\n    \n\nYou can obtain `aatt` (don't do anything), `atat` (reverse A[2..3]), `atta`\n(reverse A[2..4]), `ttaa` (reverse A[1..4]) and `taat` (reverse A[1..3]).\n\n* * *"}, {"input": "xxxxxxxxxx", "output": "1\n    \n\nWhatever substring you reverse, you'll always get `xxxxxxxxxx`.\n\n* * *"}, {"input": "abracadabra", "output": "44"}]