编程介的小学生 2017-08-26 16:32 采纳率: 20.5%
浏览 754
已采纳

Exact Symmetry

CYJJ was window-shopping at a jewelry store and was attracted by a show window full of colorful necklaces. Obsessed with symmetry, she instantly tried to find if a necklace is symmetric.

A necklace consists of colorful beads, and is called symmetric if the color of beads are symmetric with respect to some central beads. For example, the necklace in Figure 1 are symmetric with respect to the red beads, and the one in Figure 2 is not. How about Figure 3? When a necklace is too long with too many colors, CYJJ would need your help to tell her if it is symmetric or not.

Figure 1
Figure 2
Figure 3
Input
The input consists of multiple test cases. Each test case consists of a line of no more than 1000 lower case English letters of which each represents the color of a bead.

Output
For each test case, first output "Symmetric" or "Not symmetric" in a line. If the necklace is symmetric, then output the smallest index (or pair of indices) of its symmetric center in the next line. The index starts from 1 and the output format is shown in the samples.

Sample Input:
rrb
rrbnrrnb
brbnwppwn
nbrbnwprpw
wrwgyygrw
wybnwgpybpnpbypgwnbywrgr
Sample Output:
Symmetric
1-2
Symmetric
1-2
Symmetric
2
Symmetric
3
Not symmetric
Symmetric
11

  • 写回答

1条回答

报告相同问题?

悬赏问题

  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)