Lab record-04
Question 1:
Given a string, count the number of vowels (a, e, i, o, u).
Examples:
Input: "hello"
Output: 2
Input: "education"
Output: 5
Question 2:
Reverse a given string without using library functions.
Examples:
Input: "world"
Output: "dlrow"
Input: "python"
Output: "nohtyp"
Question 3:
Check whether a given string is a palindrome or not.
(A string is palindrome if it reads the same backward as forward.)
Examples:
Input: "madam"
Output: Palindrome
Input: "hello"
Output: Not Palindrome
Question 4:
Count the number of words in a given string.
Examples:
Input: "I love programming"
Output: 3
Input: "ChatGPT is awesome"
Output: 3
Question 5:
Find the frequency of each character in a string.
Examples:
Input: "apple"
Output:
a → 1
p → 2
l → 1
e → 1
Input: "banana"
Output:
b → 1
a → 3
n → 2
Question 6:
Convert all lowercase letters in a string to uppercase and vice versa.
Examples:
Input: "HeLLo"
Output: "hEllO"
Input: "Python"
Output: "pYTHON"
Question 7:
Find the length of a string without using the built-in strlen() function.
Examples:
Input: "OpenAI"
Output: 6
Input: "C programming"
Output: 13
Question 8:
Remove all spaces from a given string.
Examples:
Input: "Hello World"
Output: "HelloWorld"
Input: "Data Structures"
Output: "DataStructures"
Question 9:
Count the number of digits, alphabets, and special characters in a string.
Examples:
Input: "A1@B2#C3"
Output:
Alphabets = 3
Digits = 3
Special Characters = 2
Question 10:
Find the first non-repeating character in a string.
Examples:
Input: "swiss"
Output: "w"
Input: "success"
Output: "u"