编程介的小学生 2017-05-04 07:49 采纳率: 20.5%
浏览 596
已采纳

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

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-05-05 03:31
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看