#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N = int(readline()) S = read().rstrip().decode() # %% def test(n, alphabets, word): """alphabetsを使ってwordより真に大きいものをn個つくれる""" if n <= 0: return True if not word: return len(alphabets) >= n w = word[0] while alphabets and alphabets[-1] > w: alphabets.pop() n -= 1 if n <= 0: return True if len(alphabets) < n: return False if alphabets[-n] < w: return False return test(n, alphabets[:-n], word[1:]) # %% A = sorted(S) left = 0 right = N + 1 while left + 1 < right: x = (left + right) // 2 if test(x, A[:], 'yuki'): left = x else: right = x # %% print(left)