Problem F: 交换的次数

Problem F: 交换的次数

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

给定一个只由 

lns="http://www.w3.org/1998/Math/MathML">0 与 lns="http://www.w3.org/1998/Math/MathML">1 构成序列,不断扫描序列,如果发现有一个 lns="http://www.w3.org/1998/Math/MathML">1 与一个 lns="http://www.w3.org/1998/Math/MathML">0 相邻,且 lns="http://www.w3.org/1998/Math/MathML">1 在前,lns="http://www.w3.org/1998/Math/MathML">0 在后,就交换它们的位置。不断进行这样的调整,直到所有的 lns="http://www.w3.org/1998/Math/MathML">0 都在 lns="http://www.w3.org/1998/Math/MathML">1 之前为止。

请计算需要进行多少次交换才能完成调整。

Input

  • 若干 01 字符组成的一个序列

设 lns="http://www.w3.org/1998/Math/MathML">n 表示序列的长度,

  • lns="http://www.w3.org/1998/Math/MathML">30% 的数据,lns="http://www.w3.org/1998/Math/MathML">1n20
  • lns="http://www.w3.org/1998/Math/MathML">60% 的数据,lns="http://www.w3.org/1998/Math/MathML">1n5000
  • lns="http://www.w3.org/1998/Math/MathML">100% 的数据,lns="http://www.w3.org/1998/Math/MathML">1n300,000

Output

  • 单个整数:表示交换的次数。

Sample Input Copy

010101

Sample Output Copy

3