We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
-- Enter your code here. Read input from STDIN. Print output to STDOUTdoCalculation::Char->[Char]->Int->[Char]doCalculationy[]_=[y]doCalculationy(x:xs)n=ify==xthen[y]++doCalculationHelperx(xs)(n+1)else[y]++doCalculationx(xs)(0)wheredoCalculationHelper::Char->[Char]->Int->[Char]doCalculationHelper_[]n'=show(n'+1)doCalculationHelpery'(x':xs')n'=ify'==x'thendoCalculationHelperx'(xs')(n'+1)elseshow(n'+1)++doCalculationx'xs'0main::IO()main=doline<-getLineleth=doCalculation(headline)(tailline)0putStrh
Here you go, guys. Solution without using the "import" statement. If you guys have any further question about my code or any further improvements, do not hesitate to write.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
String Compression
You are viewing a single comment's thread. Return to all comments →
Here you go, guys. Solution without using the "import" statement. If you guys have any further question about my code or any further improvements, do not hesitate to write.