• [1307] English Magic

  • 时间限制: 2000 ms 内存限制: 65535 K
  • 问题描述
  • XP's English is very poor! He will read A into ah! Now he needs you to do him a favor! Now he gives you two same length string s1 and s2, and you should use some rules change s1 into s2
    Each time, you can add or minus 1 to any character.( When add 1 to 'z', the character will change to be 'a' and when minus 1 to 'z', the character will change to be 'a')
    You can also exchange the character with its neighbor. Each action will take one step. Now your task is to tell XP the minimal steps to transform.
  • 输入
  • There are many cases.
    Each test case contain two strings s1 and s2.It guarantee s1's length equal to s2's length and the length of the string will not exceed 5.
  • 输出
  • For each test case, print the minimal steps in one line
  • 样例输入
  • aaa
    bbb
    
    aoxz
    oaxa
    
  • 样例输出
  • 3
    2
  • 提示
  • The first case:aaa->baa->bba->bbb 
    The second case: aoxz->oaxz->oaxa 
  • 来源
  • 加多宝凉茶
  • 操作

显示春菜