Unique String Arrangements

Company: Meesho_14sep

Difficulty: medium

Problem Statement

Unique String Arrangements Problem Description In the futuristic city of Nexus Prime, a tech organization stores large amounts of encrypted data files. Each file is a string S made of words, and a file is scrambled by rearranging the letters of its words, which creates different encryption patterns. Dr. Axiom, the lead researcher, wants to know how many different encryption patterns a file can have. The spaces in S never move: every space stays exactly where it is, so the file keeps the same number of words and every word keeps its length. Only the letters inside each word are rearranged, and each word is rearranged independently of the others. Two patterns are different if they differ in at least one position. Count the number of distinct encryption patterns of S (the original arrangement counts as one of them). Since the answer can be very large, print it modulo 10^9 + 7 . Input Format Read from standard input. S The first and only line contains the string S : one or more words of lo