Links and Pearls

题意翻译

项链由线("-")和珍珠("o")构成,你可以将任意一段线或一颗珍珠插入到项链的其它位置,但不能丢弃或添加线和珍珠。 你的目标是让每两个相邻珍珠之间的线的数量相等。如果两颗珍珠之间没有其它珍珠,则认为它们相邻。 请注意,最终项链的长度应与原来的相等。项链是圆形的,所以项链的末尾连接着项链的开头。 输入输出格式 输入格式: 输入一个字符串,代表项链,"-"表示线,小写字母英文字母'o'表示一颗珍珠。 输出格式: 如果可以让每两个相邻珍珠之间的线的数量相等,就输出"YES",否则输出"NO"。 由 @bcr_233 提供翻译

题目描述

A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF980A/b745942c0cf2ccf3a30d3ebe08588dd614491eac.png)You can remove a link or a pearl and insert it between two other existing links or pearls (or between a link and a pearl) on the necklace. This process can be repeated as many times as you like, but you can't throw away any parts. Can you make the number of links between every two adjacent pearls equal? Two pearls are considered to be adjacent if there is no other pearl between them. Note that the final necklace should remain as one circular part of the same length as the initial necklace.

输入输出格式

输入格式


The only line of input contains a string $ s $ ( $ 3 \leq |s| \leq 100 $ ), representing the necklace, where a dash '-' represents a link and the lowercase English letter 'o' represents a pearl.

输出格式


Print "YES" if the links and pearls can be rejoined such that the number of links between adjacent pearls is equal. Otherwise print "NO". You can print each letter in any case (upper or lower).

输入输出样例

输入样例 #1

-o-o--

输出样例 #1

YES

输入样例 #2

-o---

输出样例 #2

YES

输入样例 #3

-o---o-

输出样例 #3

NO

输入样例 #4

ooo

输出样例 #4

YES