Tag Archives: String

C program to remove first occurrence of a word from string

Write a C program to input any string from user and remove first occurrence of a given word from string. Write a function to remove first occurrence of a word from the string. How to remove first occurrence of a word from the string in C programming. Logic to remove first occurrence of a word from given string.

Example

Input

Input string : Learn programming at Codeforwin.
Input word to remove : Learn

Output

String after removing 'Learn': 
programming at Codeforwin.

Continue reading C program to remove first occurrence of a word from string

C program to find last occurrence of a character in a string

Write a C program to input any string from user and find the last occurrence of a given character in the string. How to find the last occurrence of a given character in the string. Logic to find last occurrence of a given character in a string in C program.

Example

Input

Input string: I love Codeforwin.
Input character to search: o

Output

Last index of 'o' is 12.

Continue reading C program to find last occurrence of a character in a string

C program to remove all occurrences of a character from string

Write a C program to remove all occurrences of a given character from the string using loop. Write a function to remove all occurrences of a character from a string. How to remove all occurrences of a character from the string in C programming. Logic to remove all occurrences of a character from a given string in C program.

Example

Input

Input string : I Love Programming. I Love Codeforwin.
Input character to remove : 'I'

Output

String after removing all 'I' : Love Programming. Love Codeforwin.

Continue reading C program to remove all occurrences of a character from string

C program to remove last occurrence of a character from the string

Write a C program to read any string from user and remove last occurrence of a given character from the string. How to remove the last occurrence of a character from string in C programming. Logic to remove last occurrence of a character from the string.

Example

Input

Input string : I love programming. I love Codeforwin.
Input character to remove : 'I'

Output

String after removing last 'I' : I love programming. love Codeforwin.

Continue reading C program to remove last occurrence of a character from the string

C program to remove first occurrence of a character from string

Write a C program to read any string from user and remove first occurrence of a given character from the string. The program should also use the concept of functions to remove the given character from string. How to remove first occurrences of a given character from the string.

Example

Input

Input string: I Love programming. I Love Codeforwin. I Love India.
Input character to remove: 'I'

Output

Love Programming. I Love Codeforwin. I Love India.

Continue reading C program to remove first occurrence of a character from string

C program to find first occurrence of a word in a string

Write a C program to find the first occurrence of word in a string using loop. How to find the first occurrence of any word in a given string in C programming. Logic to search a word in a given string in C programming.

Example

Input

Input string: I love programming!
Input word to search: love

Output

'love' is found at index 2.

Continue reading C program to find first occurrence of a word in a string

C program to find the first occurrence of a character in a string

Write a C program to input any string from user and find the first occurrence of a given character in the string. How to find the first occurrence of a given character in a string in C programming. Logic to find first occurrence of a character in a string in C programming.

Example

Input

Input string: I love Codeforwin.
Input character to search: o

Output

'o' is found at index 3

Continue reading C program to find the first occurrence of a character in a string

C program to compare two strings

Write a C program to compare two strings using loop character by character. How to compare two strings without using inbuilt library function strcmp() in C programming. Comparing two strings lexicographically without using string library functions. How to compare two strings using strcmp() library function.

Example

Input

Input string1: Learn at Codeforwin.
Input string2: Learn at Codeforwin.

Output

Both strings are lexographically equal.

Continue reading C program to compare two strings

C program to find total number of alphabets, digits or special characters in a string

Write a C program to count total number of alphabets, digits or special characters in a string using loop. How to find total number of alphabets, digits and special characters in a string in C programming.

Example

Input

Input string: I love Codeforwin.

Output

Alphabets = 15
Digits = 0
Special characters = 3

Continue reading C program to find total number of alphabets, digits or special characters in a string

C program to concatenate two strings

Write a C program to concatenate two strings in single string. How to concatenate two strings to one without using strcat() library function. Adding two strings into one without using inbuilt library function. Logic to concatenate two strings in C programming. C program to concatenate two strings using strcat() library function.

Example

Input

Input string1: I love
Input string2: Codeforwin

Output

Concatenated string: I love Codeforwin

Continue reading C program to concatenate two strings