(偶还是新手,一下子给偶这么难的题目,,受不鸟....花了哦1+小时才弄出来...想了老半天,头都快抓破了没在可读性上下功夫....看得我头昏眼花的)
答:- @echo off
- setlocal EnableDelayedExpansion
- set str=abcdefghijklmnopqrstuvwxyz
- set /p word=请输入几个小写字母...
- set a=0
- :xx
- call set word1=%%word:~%a%,1%%
- set end=%end%%word1%+
- if "%word1%"=="" (goto end)
- for /l %%i in (0,1,25) do (
- set var=%%i
- call set str1=%%str:~!var!,1%%
- if !str1!==%word1% (call set /a endword=%endword%+!var!+1))
- set /a a+=1
- goto xx
- :end
- echo %end:~0,-2%=%endword%
- pause
复制代码 效果:
===================
end;(最后抱怨下楼主...so difficult) |