# Problem Definition

## Description

Given a string, find the rank of the string amongst its permutations sorted lexicographically.
Note that the characters might be repeated. If the characters are repeated, we need to look at the rank in unique permutations.
Look at the example for more details.

Example :

```plaintext
Input : 'aba'
Output : 2

The order permutations with letters 'a', 'a', and 'b':
aab
aba
baa
```

The answer might not fit in an integer, so return your answer % 1000003

NOTE: 1000003 is a prime number
NOTE: Assume the number of characters in string < 1000003

## Notes

1. [SO Post](https://stackoverflow.com/questions/22642151/finding-the-ranking-of-a-word-permutations-with-duplicate-letters)
1. [SE Math](https://math.stackexchange.com/questions/1857204/what-is-the-rank-of-cochin/2024704#2024704)
1. [SE Math](https://math.stackexchange.com/questions/1969953/shortcut-method-to-find-rank-of-a-word-when-written-in-dictionary-for-repeating)
1. [Shortcut method](http://www.careerbless.com/calculators/rank/index.php)