Write a function:
In C# language
class Solution { public int solution (string S); }
that, given a string S of length N, returns the minimum number of substrings into which the string has to be split.
Examples:
1. Given 'world', your function should return 1. There is no need to split the string into substrings as all letters occur just once.
2. Given 'dddd', your function should return 4. The result can be achieved by splitting the string into four substrings ('d', 'd', 'd', 'd').
3. Given 'cycle', your function should return 2. The result can be achieved by splitting the string into two substrings ('cy', 'cle') or ('c', 'ycle').
4. Given 'abba', your function should return 2. The result can be
achieved by splitting the string into two substrings ('ab', 'ba').
Write an efficient algorithm for the following assumptions:
. N is an integer within the range [1..1,000,000);
string S consists only of lowercase letters (a-z).