CourseWare Wiki
Switch Term
Winter 2025 / 2026
Winter 2024 / 2025
Winter 2023 / 2024
Winter 2022 / 2023
Winter 2021 / 2022
Winter 2020 / 2021
Winter 2019 / 2020
Winter 2018 / 2019
Older
Search
Log In
b251
courses
be5b99cpl
labs
lab05
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
courses/be5b99cpl/labs/lab05.txt
· Last modified: 2025/10/22 09:33 by
ulricji1