编程介的小学生 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条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样