Huseyn's game#11389

Huseyn's game

1 saniye
128 megabayt
Kolay (≈1000)

Huseyn has a string consisting of characters and . To entertain himself, he came up with the following game. Huseyn can perform one of two operations on the string:

For example, from the string , Huseyn can obtain or .

You are given a string obtained after all of Huseyn's operations (it is possible that he did not perform any operation). Determine the smallest possible length the string could have initially had.

Giriş

A single string of length no more than 10^5, consisting only of characters and .

Çıktı

Print the smallest possible length of the string that Huseyn could have initially had.

Örnekler

Örnek 1

Loading
Loading

Örnek 2

Loading
Loading