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: def main():
      import sys
  
      input = sys.stdin.readline
      sys.setrecursionlimit(10**7)
      from collections import Counter, deque
      from collections import defaultdict
      from itertools import combinations, permutations, accumulate, groupby, product
      from bisect import bisect_left, bisect_right
      from heapq import heapify, heappop, heappush
      from math import floor, ceil, pi, factorial
      from operator import itemgetter
  
      def I():
          return int(input())
  
      def MI():
          return map(int, input().split())
  
      def LI():
          return list(map(int, input().split()))
  
      def LI2():
          return [int(input()) for i in range(n)]
  
      def MXI():
          return [[LI()] for i in range(n)]
  
      def SI():
          return input().rstrip()
  
      def printns(x):
          print("\n".join(x))
  
      def printni(x):
          print("\n".join(list(map(str, x))))
  
      inf = 10**17
      mod = 10**9 + 7
      # main code here!
      s = SI()
      n = len(s)
      dict_ = defaultdict(lambda: 0)
      for i in range(n):
          dict_[s[i]] += 1
      ans = 1 + (n * (n - 1)) // 2
      for x in dict_.keys():
          ans -= (dict_[x] * (dict_[x] - 1)) // 2
      print(ans)
  
  
  if __name__ == "__main__":
      main()
  
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"}]