编程介的小学生 2017-08-24 11:26 采纳率: 20.5%
浏览 799
已采纳

String's Puzzle

Zhu Ming and Small Li find a strange stone tablet, which has some capitals printed on it. Capitals in every string are different with each other, and every capital string is followed by a number. Because of their supernormal intelligence, Zhu Ming and Small Li find the number following the string is numbered in the order of dictionary sequence from little to big (the original number is 0).For example, when the length of capital string is 3, number following the string will be:
��
ABC 0
ABD 1
���� ��
ZYX 15599

To better study this puzzle, please make a program to given a n-length string (1 <= n <= 26), output the number of the string.

Input

There are several test cases. Each data is made up of two lines. The first line is number n (1 <= n <=26). The second line is a string with its length of n. n = 0 means end of the input.

Output

Output the string number for each group of data tested.

Sample Input

3
ABC
3
ZYX
3
ABD
4
ABCD
0

Sample Output

0
15599
1
0

  • 写回答

2条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line