#K1166. Distinct Reversed Words Count

    ID: 23518 Type: Default 1000ms 256MiB

Distinct Reversed Words Count

Distinct Reversed Words Count

You are given a string S consisting of words separated by spaces. Your task is to reverse each word individually and then determine how many distinct words there are among these reversed words.

For example, if S = "this is a test", reversing each word yields ["siht", "si", "a", "tset"], so the answer is 4 because all reversed words are different.

Note: An empty string should result in an output of 0.

The reversal of a word w can be represented in \(\LaTeX\) as:

\(reverse(w) = \text{the sequence of characters of }w\text{ in reverse order}\)

inputFormat

The input consists of a single line containing the string S, which may contain multiple words separated by spaces. The string may be empty.

outputFormat

Output a single integer representing the number of distinct words after reversing each word in the input string.

## sample
this is a test
4