|
@@ -8,9 +8,15 @@ cesar n = map (cechar n)
|
|
|
|
|
|
inlinecesar n s = map (chr.(+ ord 'a').(flip mod 26).(+ n).(subtract (ord 'a')).ord) s
|
|
|
|
|
|
+getCorrectValue::IO Int
|
|
|
+getCorrectValue = do
|
|
|
+ x <- getLine
|
|
|
+ let i = (read x)::Int
|
|
|
+ if i >= 0 && i < 26 then return i else getCorrectValue
|
|
|
+
|
|
|
main::IO ()
|
|
|
main = do
|
|
|
- n <- getLine
|
|
|
+ n <- getCorrectValue
|
|
|
s <- getLine
|
|
|
- putStrLn (cesar (read n) s)
|
|
|
- putStrLn (inlinecesar (read n) s)
|
|
|
+ putStrLn (cesar n s)
|
|
|
+ putStrLn (inlinecesar n s)
|