#include <stdio.h>
#include <stdlib.h>
typedef struct _node
{
char data;
int count;
struct _node *next;
} Node;
int main()
{
char c;
Node *head = (Node *)malloc(sizeof(Node));
head->next = NULL;
Node *last = head;
int cnt = 0;
do
{
scanf("%c", &c);
if (c != ',' && c != '\n')
{
Node *p = (Node *)malloc(sizeof(Node));
cnt++;
p->count = cnt;
p->next = NULL;
p->data = c ;
last->next = p;
last = p;
}
} while (c != '\n');
int check = 1;
Node *p = head->next;
while (p != NULL && p->count < cnt / 2 + 1)
{
Node *q = p;
while (q != NULL && q->count + p->count < cnt + 1)
q = q->next;
if (q->data != p->data)
{
check = 0;
break;
}
p = p->next;
}
if (check == 0)
printf("No\n");
else if (check == 1)
printf("Yes\n");
return 0;
}