Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
set /p string=Your string :
|
||||
set count=0
|
||||
:loop
|
||||
if "!%string%:~%count%,1!" neq "" (
|
||||
set reverse=!%string%:~%count%,1!!reverse!
|
||||
set /a count+=1
|
||||
goto loop
|
||||
)
|
||||
set palindrome=isn't
|
||||
if "%string%"=="%reverse%" set palindrome=is
|
||||
echo %string% %palindrome% a palindrome.
|
||||
pause
|
||||
exit
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
@echo off
|
||||
set /p testString=Your string (all same case please) :
|
||||
call :isPalindrome result %testString: =%
|
||||
if %result%==1 echo %testString% is a palindrome
|
||||
if %result%==0 echo %testString% isn't a palindrome
|
||||
pause
|
||||
goto :eof
|
||||
|
||||
:isPalindrome
|
||||
set %1=0
|
||||
set string=%2
|
||||
if "%string:~2,1%"=="" (
|
||||
set %1=1
|
||||
goto :eof
|
||||
)
|
||||
if "%string:~0,1%"=="%string:~-1%" (
|
||||
call :isPalindrome %1 %string:~1,-1%
|
||||
)
|
||||
goto :eof
|
||||
Loading…
Add table
Add a link
Reference in a new issue