Quick actions

cmd+k|ctrl+k

Navigation

Languages

Perl weekly challenge 114, Task #1

Snippet info

Language

Raku

Visibility

public

Author

seaker

Created

2021-05-24T09:52:36.03668Z

Updated

2021-05-24T09:55:29.880793Z

#`[
    Perl weekly chanllege 114, Task #1 Next Palindrome Number

    You are given a positive integer $N.
    Write a script to find out the next Palindrome Number higher than the given integer $N.

    Example

    Input: $N = 1234
    Output: 1331

    Input: $N = 999
    Output: 1001
#]

my method is-palindrome(UInt:D $n: --> Bool:D) { $n.flip eq $n }

put ($*IN.slurp.UInt ^.. *).grep(*.&is-palindrome)[0];
INFO