
- 帖子
- 8
- 积分
- 19
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2017-12-31
|
第二题、第三题、第一题:
@echo off
setlocal EnableDelayedExpansion
for /f "delims=" %%a in (千字文.txt) do (
for %%b in (%%a) do (
set var=%%b
for /l %%c in (0,1,3) do (
set /a #!var:~%%c,1!+=1
)
)
)
rem set #>>2.txt
for /f "tokens=1,2 delims=#=" %%a in ('set #') do (
if %%b gtr 1 echo 重复字:%%a 出现次数:%%b
)
echo:
echo:
for /f "tokens=1-6 delims= " %%a in (千字文.txt) do (
echo %%f
echo %%e
echo %%d
echo %%c
echo %%b
echo %%a
)
echo:
echo:
set m=0
for /f "delims=" %%a in (千字文.txt) do (
set x=%%a
call :next !x: =!
)
echo 千字文共有!m!字
:next
set "var=%~1"
set n=0
:loop
call set str=%%var:~!n!,1%%
if "%str%"=="" goto :eof
set /a n+=1,m+=1
goto loop
echo:
echo:
pause |
|