Strings Assignment
Note: for all strings tasks (except T1), you should take a string(s) as input from the user.
T1- Write a C# program to replace the following words with the given ones in the following sentence.
Sentence: “Hello Sameh, Welcome to Structural BIM Track. This is Round 1.”
Replace “Sameh” with your name.
Replace “Structural BIM Track” with “BIM Application Development Track”.
Replace “Round 1” with your round number.
T2- Write a C# program to read a sentence from the user and replace lowercase characters with uppercase ones.
For Example:
Input Sentence: “Hello World”
Expected Output: “HELLO WORLD”
T3- Write a C# program to extract a substring from a given string.
Note: Don’t use Substring() function.
Note: The index for a user starts from 1, while for a developer, starts from 0.
For Example:
Input string: “Hello World”
Input Index to Start Extraction from: 3
Input The Length of Substring: 6
Expected Output: “llo Wo”.
T4- Write a C# program to search the index of the first occurrence of a given character within a sentence.
If the character doesn’t exist in the sentence, print a message.
Note: The index for a user starts from 1, while for a developer, starts from 0.
Note: Ignore the case sensitivity for character search.
For Example:
Input Sentence: “Hello World”
Input Character: ‘o’
Expected Output: 5
Input Character: ‘O’
Expected Output: 5
Input Character: ‘z’
Expected Output: “The character ‘z’ doesn’t exist”
T5- Write a C# program to count the total number of vowels in a string.
T6- Write a C# program to print individual characters of a string in reverse order and separate them with spaces.
Note: Put only one space between each character.
Note: Eliminate spaces in the first or the last position of the string.
For Example:
Input: “Hello World”
Expected Output: “d l r o W o l l e H”
T7- Write a C# program to count the total number of words in a string.
For Example:
Input: “Welcome to BIM Application Development Track”
Expected Output: 6
T8- Write a C# program to check whether a given word is present in a given sentence.
For Example:
Input Sentence: “This is Task 8 in Strings Tasks”
Input Word: “is”
Expected Output: “The word ‘is’ exists in the sentence”.
Input Word: “Assignment”
Expected Output: “The word ‘Assignment’ doesn’t exist in the sentence”.
T9- Write a C# program to check if the first character of each word in a sentence is uppercase or not.
If not, print the word that doesn’t follow the condition.
For Example:
Input Sentence: “My Name Is Sameh”
Expected Output: “All Words are Following The Condition”.
Input Sentence: “My name is Sameh”
Expected Output: “There are 2 Words Not Following The Condition:”
“1- name”
“2- is”
T10- Write a C# program to find the maximum occurring character in a string.
Note: If there’s more than one character that has the maximum occurring value, get the first one only.
Note: Ignore the case sensitivity.
For Example:
Input: “HELLO World”
Expected Output: “The Highest frequency of character 'L' appears 3 times”.