You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

557 B

Find Longest Distinct Sub-Arrray

Goal

Given an array, find and return the length of the longest sub-array with the property that all its elements are distinct.

Hint: simple solutions may perform in time complexity O(n^3) or O(n^2) but solutions in O(n) are possible.

Input

A blank-separated array arbitrary symbols.

Output

The length of the longest distinct sub-array

Constraints

  • 1 <= array-length <= 50

Example

Input: f s f e t w e n w e

Output: 5

(the longest distinct sub-array is s f e t w)