String function examples, C/C++ Programming

Assignment Help:

1. De ne a function chomp :: String -> String that selects a run of repeated characters from the start of a string with the run being as long as possible.

For example

chomp "aaaaaabbbbcccc" = "aaaaaa"
chomp "ddddddddddddd" = "ddddddddddddd"

2. Using chomp, de ne a function
runs :: String -> [String ]
that splits a string into a list of runs of repeated characters, with each run comprising at most nine characters. For example:
runs "aaaaaabbbbcccc" = ["aaaaaa", "bbbb", "cccc"]
runs "ddddddddddddd" = ["ddddddddd", "dddd"]

3.De ne a function
flatten :: [(Char, Int)] -> String
that
attens a list of pairs of characters and digits to a string. For example:
flatten [(a, 5), (b, 4), (c, 2)] = "a5b4c2"
flatten [(d, 9), (d, 3)] = "d9d3"


Related Discussions:- String function examples

Copy constructor and an overloaded assignment operator, What is the differe...

What is the difference among a copy constructor and an overloaded assignment operator? Ans) A copy constructor constructs a latest object by using the content of the argument

Wap to print sum=1!+2!+3!+4!+....n!, WAP TO PRINT SUM=1!+2!+3!+4!+....N! ...

WAP TO PRINT SUM=1!+2!+3!+4!+....N! #include stdio.h> #include conio.h>   void main() {                    int n,i;                    float sum=0,fac

Console atm machine coding, construct a console programme for a bank ATM m...

construct a console programme for a bank ATM machine.

Files, redirection in c++

redirection in c++

Inside and outside type casting, depth description of the inside and outsid...

depth description of the inside and outside typecasting

Padovan string, write a program that counts the number of occurrences of th...

write a program that counts the number of occurrences of the string in the n-th Padovan string P(n)   program in java // aakash , suraj , prem sasi kumar kamaraj college

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd