a = gets.chomp.split('')
n = a.length - 1
ans = []
if a.uniq.length == a.length then
  puts a.length
else
  0.upto((2**n)-1) do |i|
    buf = ""
    bin = "%0#{n}d" % i.to_s(2)
    bin.split('').each_with_index do |s, idx|
      if s == "1"
        buf += "#{a[idx]}+"
      else
        buf += "#{a[idx]},"
      end
    end
    buf += a[-1]
    buf_split = buf.split(',')
    buf_split.each_with_index do |s, idx|
      break if buf_split[idx] == buf_split[idx+1]
      ans << buf_split.length if idx == buf_split.length - 1
    end
  end
  puts ans.max
end