Table of Contents
Lab05 - Strings and (de)allocation
Task 1
Task 2
Task 3
Task 4
Lab05 - Strings and (de)allocation
Task 1
Write a program that has a long string as the command-line argument
It will print the string's length (create a custom
size_t string_length(const char* str)
function)
It will print the string in reverse order
Task 2
Reads a line of text (max 200 characters).
Splits it into words separated by spaces.
Removes duplicate words (case-insensitive).
Prints the cleaned sentence with single spaces between words.
Task 3
Reads a line of text (max 100 chars).
Ignores spaces and case.
Checks whether the text is a palindrome (reads the same forward and backward). e.g. “Never odd or even”, “level”, “radar”
Prints “Palindrome” or “Not a palindrome”.
you can use
https://www.madeintext.com/palindrome-generator/
to generate dummy polindromes or pick inputs from
https://wordlistfinder.com/blog/palindrome-words/
Task 4
Read an “infinit” text.
Counts and prints:
The number of words
The total number of letters
Histogram of letters
The longest word and its length