
UVa 11572 contains a story about a magic snowflake-capturing machine, but the underlying puzzle can be stated quite simply:
Given a sequence of integers, find the length of the longest contiguous subsequence containing no repeated elements.
The sequence given in the sample input is:
1, 2, 3, 2, 1
The subsequence 1, 2, 3, 2 (length=4) does not meet the criteria, since the element 2 is repeated. However, 1, 2, 3 (length=3) does, as does 3, 2, 1. Since there isn’t a longer subsequence that meets the criteria, the correct answer to the sample problem is 3.








