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

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法