Found 7346 Articles for C++

Count of three non-overlapping substrings which on concatenation forms a palindrome

Sonal Meenu Singh
Updated on 31-Jul-2023 19:48:53

93 Views

Introduction In this tutorial, we will elaborate an approach for finding three non-overlapping substrings from a given string s, and when all substrings are combined together they form a palindrome. To solve this task we use the string class features of the C++ programming language. Palindrome in a string means the string reads the same in both forward and backward directions. The palindrome string example is Madam. Suppose there is a string "s" and the substrings are a, b, and c. When you combine a, b, and c, they form a palindrome string. Here is an example to understand the ... Read More

Print first and last character of each word in a string

Mallika Gupta
Updated on 31-Jul-2023 17:49:26

708 Views

Introduction A C++ string is contiguous storage of alphanumeric characters as well as special characters. A string has the following properties − Every C++ string is associated with a fixed length. Character operations can be easily performed with the string characters. A string is composed of words, which are space separated. In this article, we are going to develop a code that takes as input a string, and displays the last character of each word in the string. Let us look at the following example to understand the topic better − Sample Example Example 1 − str − ... Read More

Pairs of strings which on concatenating contains each character of “string”

Mallika Gupta
Updated on 31-Jul-2023 17:42:45

31 Views

Introduction A stream of characters flowing together collectively comprising of alphanumeric characters as well as special symbols can be termed as a C++ string. String concatenation is an important aspect of the string data structure, since it is used to combine different sub strings or words to form complete sentences. Concatenation in C++ can be simply done using the + operator. In this article, we are going to develop a code that takes as input an array of string, and then analyses each pair to see if that pair contains all the letters of the word “string” . Let us ... Read More

Print last character of each word in a string

Mallika Gupta
Updated on 31-Jul-2023 17:46:19

758 Views

Introduction C++ strings are essentially a combination of words used as a storage unit to contain alphanumeric data. The words in a string are associated with the following properties − The word positions begin with 0. Every word is associated with a different length. The characters combine together to form words, which eventually form sentences. By default, the words are separated by a space character. Every word contains at least one character. In this article, we are going to develop a code that takes as input a string, and displays the last character of each word in ... Read More

Longest double string of a Palindrome

Mallika Gupta
Updated on 31-Jul-2023 17:39:35

58 Views

Introduction A contiguous sequence of characters, comprising of upper case, lower case, repetitive or unique alphanumeric characters form a C++ string. Every string is recognized by a unique length parameter, which may be odd or even in nature. A palindromic string is the same sequence of characters encountered from both the beginning as well as the end. The characters at equivalent positions from start and end do not differ. They may be even length or odd length palindromes. The odd length palindrome has a middle character separating the two equivalent halves. In this article, we are going to develop a ... Read More

Count of strings satisfying the given conditions

Mallika Gupta
Updated on 31-Jul-2023 17:28:44

67 Views

Introduction A string in C++ is also a primitive data type which is comprised of alphanumeric characters. The letters in a string are case sensitive, but strings can contain both upper and lower case. In this article, we are given an input array of lowercase strings, and require the count of the pair of strings from the array satisfying the following conditions − Both the strings should have the same first and last vowel Both the strings have an equal number of pairs An array is a data structure simulating the storage of similar elements. A C++ array ... Read More

Check if frequency of each character is equal to its position in English Alphabet

Sakshi Koshta
Updated on 31-Jul-2023 17:23:48

154 Views

An integral consideration when examining character frequencies and their place within the English alphabet is determining whether each character's frequency within a string aligns with its corresponding location within the alphabet. Each letter of this 26-letter system holds an assigned position ranging from one through twenty-six. Consequently, we must explore how one can recognize if a character's count in each string correlates with its alphabetical place. The following topic will delve into this issue while exploring whether identifying these frequencies can facilitate validating and investigating connections between character frequency and placement within our beloved language's alphabetical order. Methods Here are ... Read More

How to validate CVV number using Regular Expression?

Sakshi Koshta
Updated on 31-Jul-2023 16:31:14

523 Views

A three- or four-digit number is called the Card Verification Value, or CVV, that is found on the back of most of the credit cards and debit cards as well as on the front of American Express cards. It is also known as CVV2 and CSC (Card Security Code). The CVV code is a security mechanism to ensure that the person making the purchase has a valid card. It was developed to aid in preventing unauthorised transactions. It is typically required when making online purchases over the phone or without a card on hand. Method The following methods are used ... Read More

Encrypt a string by repeating i-th character i times

Mallika Gupta
Updated on 31-Jul-2023 17:36:26

75 Views

Introduction A C++ string is a fixed sequence of alphanumeric characters. It is a continuous stream of occurring characters, which may be digits, characters or even special symbols. Every string is characterized by a definite length. The positions by which the characters are accessed begin with 0. Strings can contain unique or repeated characters concatenated together. They can be subjected to various manipulations and concatenation operations. In this article, we are going to develop a code that takes as input a string, and displays the encrypted string, wherein the first character is repeated 1 time, the second character is ... Read More

Count of buttons pressed in a keypad mobile

Mallika Gupta
Updated on 31-Jul-2023 17:11:33

129 Views

Introduction A string in C++ is an in-built storage structure used to contain digits, characters or even special symbols. Every string is associated with a definite size, specified by its length attribute. By default, the string positions begin with 0. The characters in string can be subjected to various types of manipulations − New characters can be appended at the end of a string. A character can be appended multiple times to the string. In this article, we are going to develop a code that takes as input a string, and counts the number of times the keys ... Read More

Advertisements