问题1681--【USACO】Wiggle Numbers

1681: 【USACO】Wiggle Numbers

时间限制: 1.000 Sec  内存限制: 64 MB
提交: 21  解决: 9
[提交] [状态] [讨论版] [命题人:]

题目描述

These positive integers: 3748, 67, 869, 32435465768 are all wiggle numbers because if you examine the digits of each number they go up, down, up, down, ... or down, up, down, up, down, up, ... For example: 3 < 7 > 4 < 8 and 3 > 2 < 4 > 3 < 5 > 4 < 6 > 5 < 7 > 6 < 8 A single digit is a wiggle number of length 1. Write a program that will determine how many of the initial digits of a number form a wiggle number. The answer could, of course, be the length of the number in some cases.

输入

A single line with a single positive integer no longer than 75 digits.

输出

A single integer that is the number of initial digits of the number that form a wiggle number.

样例输入 复制

3748

样例输出 复制

4

来源/分类


[提交] [状态]