You are given a string s, where every two consecutive vertical bars ‘|’ form a pair. Count the number of ‘’ in s, excluding the ‘’ between each pair of ‘|’.
Given a cipher key and a secret message, decode the message by replacing each letter with the corresponding letter in the alphabet based on the first appearance of each letter in the key. Spaces in the message remain unchanged.
You are given two strings start and target, each consisting of the characters 'L', 'R', and '_'. The goal is to check if it is possible to transform the string start into target by moving the ‘L’ and ‘R’ characters. ‘L’ can only move to the left and ‘R’ can only move to the right. A blank space can be occupied by either ‘L’ or ‘R’.
You are given a list nums where each string contains digits of the same length. Additionally, you are provided a list of queries, where each query is represented by two integers [ki, trimi]. For each query, trim each number in nums to its rightmost trimi digits, then find the index of the kith smallest trimmed number. If two numbers are identical after trimming, the one with the lower index is considered smaller. Reset the numbers in nums for the next query.
You are given a string s consisting of lowercase letters and an integer k. A string t is considered ideal if it is a subsequence of s and the absolute difference in the alphabet order of every two adjacent letters in t is less than or equal to k. Your task is to return the length of the longest ideal string.