import           Control.Applicative
import           Control.Monad
import           Control.Monad.ST
import           Data.Array.MArray
import           Data.Array.ST
import           Data.Array.Unboxed
import           Data.Char
import           Text.Printf         (printf)

createArray :: String -> UArray Char Int
createArray xs = runSTUArray $ do
    a <- newArray ('a', 'z') 0
    forM_ xs $ \x -> do
        n <- readArray a x
        writeArray a x (n + 1)
    return a

main :: IO ()
main = do
    xs <- fmap toLower . filter isAlpha <$> getContents
    let ary = createArray xs
    forM_ (assocs ary) $ \(a, k) -> do
        printf "%c : %d\n" a k

