Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Palindrome-detection/Modula-3/palindrome-detection.mod3
Normal file
15
Task/Palindrome-detection/Modula-3/palindrome-detection.mod3
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
MODULE Palindrome;
|
||||
|
||||
IMPORT Text;
|
||||
|
||||
PROCEDURE isPalindrome(string: TEXT): BOOLEAN =
|
||||
VAR len := Text.Length(string);
|
||||
BEGIN
|
||||
FOR i := 0 TO len DIV 2 - 1 DO
|
||||
IF Text.GetChar(string, i) # Text.GetChar(string, (len - i - 1)) THEN
|
||||
RETURN FALSE;
|
||||
END;
|
||||
END;
|
||||
RETURN TRUE;
|
||||
END isPalindrome;
|
||||
END Palindrome.
|
||||
Loading…
Add table
Add a link
Reference in a new issue