Found 7197 Articles for C++

Longest double string of a Palindrome

Aishwarya Naglot
Updated on 05-Nov-2024 15:01:01

113 Views

A contiguous sequence of characters, consisting of uppercase, lowercase, repetitive, or unique alphanumeric characters, forms a C++ string. Each string has a unique length, which may be either odd or even in nature. Longest Double String of a Palindrome A Palindromic string is a sequence of characters that reads the same from both the beginning and the end. In other words, characters at equivalent positions from the start and end have no difference. These palindromes can either have an even length or an odd length. The odd-length palindrome features a middle character separating the two equivalent halves. In this article, ... Read More

Count of strings satisfying the given conditions

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

161 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

288 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

994 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

140 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

283 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

Check if the string contains consecutive letters and each letter occurs exactly once

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

2K+ Views

Introduction A string in C++ is a sequence of characters, which may be distinct or repetitive in nature. Consecutive characters are the characters occurring simultaneously, with a difference of 1. For instance, the characters a and b are consecutive, since they occur together. However, the characters m and o have a difference of 2 in their positions, which make them non-consecutive in nature. In this article, we are going to develop a code that takes as input a string, and displays true in case all the characters in a string are consecutive. Let us look at the following example ... Read More

Character whose frequency is equal to the sum of frequencies of other characters of the given string

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

158 Views

Introduction A C++ string is a stream of alphanumeric characters. A string has the following properties − A string is composed of a fixed set of characters The strings positions start by default from the 0th index Frequency of any character is the number of times it occurs in the string. The frequency of any any character can range from 0 , if it doesn’t occur to the length of the string. In this article, we are going to develop a code that takes as input a string, and checks whether the frequency of any character is equivalent ... Read More

Count of pairs of strings which differ in exactly one position

Mallika Gupta
Updated on 31-Jul-2023 17:25:32

356 Views

Introduction A string is composed of alphanumeric characters, each of which is associated with a definite position. The positions of the characters range from 0 to the string length. The characters differing exactly in one position are said to be adjacent. In this article, we are going to develop a code that takes as input an array of strings which differ in exactly in one position. Let us look at the following example to understand the topic better − Sample Example Example 1 − str − {“abc”, “cba”, “dbc” , “acc”} Output − 2 For instance, in ... Read More

Check if left and right shift of any string results into given string

Sakshi Koshta
Updated on 31-Jul-2023 16:12:50

576 Views

A collection of characters is represented by a string data type. It is arranged logically using letters, numbers, symbols, and empty spaces. The majority of computer languages enclose strings in single or double quotation marks to distinguish them from other data types. Programmers frequently employ strings to carry out some input and output operations, the storing, and the manipulation of textual data, and more. Concatenation (combining two or more strings), substring extraction (obtaining a segment of a string) and searching for certain characters or patterns inside a string are some frequent operations that can be carried out on strings. Methods ... Read More

Advertisements