Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substring() method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990. Ex: If the input is: March 1, 1990 April 2 1995 7/15/20 December 13, 2003 -1 then the output is: 3/1/1990 12/13/2003
Q: def words_rhyme(word1: str, word2: str, word_to_phonemes: PRONUNCIATION_DICT) -> bool: """Return…
A: Task : The task is to define the function words_rhyme that returns true if the last syllable…
Q: e Write a program that produces a Caesar cipher of a given message string. A Caesar cipher, or…
A:
Q: 2. Consider the following 3 strings over the alphabet {a,b} : S 3 ааааа, T = abbb, R= bbbbb. Which…
A: Let's solve the question step by step: Given words S = aaaaa T = abbb R = bbbbb Option (a) There…
Q: Write an ASM program that prompts the user to enter a string of at most 128 characters and then…
A: #include<stdio.h>#include<string.h>int main(){ int l,i,Ucount=0,temp; char…
Q: Please answer in c++ only In Chefland there is a competition with N participants (numbered 1 to N).…
A: The C++ code is given below with code and output screenshot Happy Coding?
Q: How can you reverse a string?
A: Given To know how to reverse string.
Q: def substitution(plainText, key): Returns encrypted string for the plainText using substitution…
A: Method- replace(letter, key): 1. If letter is not an alphabet 1. Return letter 2. If letter is…
Q: Write a program to accept a string from the user and display characters that are present at an even…
A: here in this question we have asked to write a program which take any string from the user and…
Q: Show the string that would result from each of the following string formatting operations. If the…
A: "Looks like {1} and {0} for breakfast".format("eggs","spam") Answer Looks like spam and eggs for…
Q: Take input a string s and a positive integer i and then create a new string in which the character…
A: JAVA code for the problem to remove character from string at i'th index is provided in step 2.
Q: Implement a function that finds the first position of any characters from a set in a given string.…
A: File name: "strings.cpp" #include <iostream> using namespace std; /*Define a method to find…
Q: word and check whether that word is a palindrome or not. A palindrome is a string that is spelled…
A: import java.util.*; class Main { public static void main(String args[]) { String…
Q: Crime Wave - The Sequel Description n blanks have been robbed this find day. m (greater than or…
A: ANSWER:-
Q: Please answer in c++ only In Chefland there is a competition with N participants (numbered 1 to N).…
A: Input-Output Details: first' lines's of input contain's single integer TT denoting number of test…
Q: Using Java, Write a value-returning method, isVowel that returns the value true if a given character…
A: Required: Using Java, Write a value-returning method, isVowel that returns the value true if a given…
Q: From the following string, phrase = "Once upon a midnight dreary ..." Give the expression that…
A: The answer is given below. Slicing works with lists, but it has one additional feature that is very…
Q: The concatenation of strings s1 and s2, written s1+s2, modifies s1 by appending string s2 to it.
A: The concatenation of strings s1 and s2, written s1+s2, modifies s1 by appending string s2 to it.true…
Q: example below). The sentence will consist of words separated by a space, where the last word ends…
A: code : #ask user to enter number of testcases t=int(input()) while(t!=0): #ask user to enter…
Q: Write down the algorithm (not code) to search a string in a BST?
A: A Binary Search Tree is a type of binary tree where the elements are sorted The sorting is done in…
Q: Language: Java Write a program that reads a sentence from the keyboard. Depending on the last…
A: A required program is as follows, File name: "Main.java" import java.util.*; public class Main {…
Q: Write a function decode_string() that gets a string as a parameter -so called encrypted string-,…
A: Part4: Algorithm: Start Read a string Initialize the dictionary with given data Initialize an empty…
Q: Given an input string, delete recursively all the duplicate adjacent characters and return a string…
A: Hello student, hope you are doing good. In this question, as the coding langauge is not mentioned so…
Q: Give regular expressions for the following L1 = set of all strings of 0 and 1 ending in 00 L2 = set…
A: Given L1 = set of all strings of 0 and 1 ending in 00 L2 = set of all strings of 0 and 1 beginning…
Q: For the alphabet (a, b) the regular expression (aa)*(bb)*b denotes Set of strings with 2 a's…
A:
Q: Let s be a string of length 2 with characters from {0, 1, 2}, and define statements a, b, c, and d…
A: Given the length of the string is 2 and the given characters are {0,1,2} where a = “the first…
Q: Given the strings sl and s2, not necessarily of the same length, create a new string consisting of…
A: Answer 1: Source Code:
Q: You are given a text file (datal.txt) that consists of different garbage strings. Your task is to: •…
A: String is basically an object that represents sequence of char values
Q: What is the length of the following list? Equivalently, if the list below was assigned to the…
A:
Q: Take a sentence and as well as a word/character(s) and return True if the word/character(s) can be…
A: Below is the code in python as language not specified and sample output:
Q: Please answer in c++ only In Chefland there is a competition with N participants (numbered 1 to N).…
A: The C++ code is given below with code and output screenshot
Q: 25) If the statement a.substring(1, a.length( ) – 1) were changed to be (a.substring(1, a.length(…
A: Given that, If the statement a.substring(1, a.length( ) – 1) were changed to be (a.substring(1,…
Q: 3. Write a program that transforms numbers 1, 2, corresponding month names January, February, March,…
A: Introduction: Here we are required to write a program that will display month according to the…
Q: For this function, you must build a string that when printed, // will output the entire binary…
A: Task : Given the function declaration. The task is to complete the implementation of the function.
Q: Encryption is commonly used to disguise messages on the internet. A Caesar cipher performs a shift…
A: #include <stdio.h>#include <stdlib.h> int main(){ int size=100; char val[size];…
Q: Improve the given code below, make sure that the code will require input from the user. Problem:…
A: The split() method splits a String object into an array of string by separating the string into sub…
Q: Please write a program in Java to implement the Caesar Cipher: a. Implement the encryption…
A: This is a program to implement the Caesar Cipher. Step 1 is the written code and step 3 and 4 is the…
Q: Question 4 You will be given a String S which contains only two characters - A and B. Your task is…
A: The outermost loop selects a starting character, while the middle looping considers all characters…
Q: How to count a specific number of consonants in c. For example, I would like to separately count the…
A: We need to find another short method to print number of individual consonants from j to n.
Q: A sequence of n>0 integers is called a jolly jumper if the absolute values of the differences…
A: Answer: Here not mention any specific language use so we have done code in C++ programming language…
Q: c++ , A character string is given. What is the minimum number of characters you need to change to…
A: Answer is given below-
Q: 25) If the statement a.substring(1, a.length( ) – 1) were changed to be (a.substring(1, a.length(…
A: please see the next step for solution
Q: 3. Experiment with the following code for different strings assigned to s: # yourstring goes here S…
A: As per guidelines i can answer only one question so for answer of other questions ask separately.
Q: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full…
A: class PatternChecker { public boolean check(String pattern, String str) { char[] pt =…
Q: 25. Write the strings if the value of m and n as stated below. Given examples of the first language.…
A: Here below figure we find all the string:…
Q: Use C++ Write a program that replaces words in a sentence. The input begins with an integer…
A: A required program is as follows, #include<iostream> #include<vector> using namespace…
Complete main() to read dates from input, one date per line. Each date's format must be as follows: March 1, 1990. Any date not following that format is incorrect and should be ignored. Use the substring() method to parse the string and extract the date. The input ends with -1 on a line alone. Output each correct date as: 3/1/1990.
Ex: If the input is:
March 1, 1990
April 2 1995
7/15/20
December 13, 2003
-1
then the output is:
3/1/1990
12/13/2003
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
- Substitution ciphers are encryption/decryption algorithms that replace one letter or number with another. The first attested use of a substitution cipher in military affairs was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). In caesar cipher , you replace each letter by 3rd letter on. If it is out of bound (later than Z), then round to the head (letter A) and continue the shift. For example:meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB Please write a program in Java to implement the Caesar Cipher: a. Implement the encryption algorithm. Ask the user to input one all lower case normal sentence (called plaintext) using the nextLine method, and then output the encrypted text (called ciphertext). b. Implement the decryption algorithm. Ask the user to input one encrypted sentence (i.e. ciphertext) using the nextLine method, and then output the decrypted text (i.e. plaintext).Please explain Crime Wave more clearly for me please there's a picture of the decription and also please comment on each line if possible on the code below to for me to have a better understanding of what each line is doing. It is in C++. Please also give the space and time complexity and the reason why. #include <stdio.h>#include <string.h>#include <math.h>#define eps 1e-6double W[105][105];int N, M;int mx[105], my[105]; // match arrdouble lx[105], ly[105]; // label arrint x[105], y[105]; // used arrint hungary(int nd) { int i; x[nd] = 1; for(i = 1; i <= M; i++) { if(y[i] == 0 && fabs(W[nd][i]-lx[nd]-ly[i]) < eps) { y[i] = 1; if(my[i] == 0 || hungary(my[i])) { my[i] = nd; return 1; } } } return 0;}double KM() { int i, j, k; double d; memset(mx, 0, sizeof(mx)); memset(my, 0, sizeof(my)); memset(lx, 0, sizeof(lx)); memset(ly, 0, sizeof(ly));…Computer Science you are given a string X of length n and another string Y of length m ≤n. Say,the indexes p1, p2, p3, p4 and q1, q2, q3, q4 form two sub-sequences, i.e., 0 ≤ p1 < p2 < p3 < p4 < nand 0 ≤q1 < q2 < q3 < q4 < n; then, they are non-overlapping if p4 < q1.The task is to count the maximum number of non-overlapping sub-sequences of X that are thesame as Y . Thus, if X = GAXTYAWBGTAUGBTABGRGTAXB and Y = GTAB, then the answer is3 as shown by the red fonts. We cannot select the underlined GTAB as it overlaps with a red GTAB(i.e., among overlapping sub-sequences, you can select only one of them).Describe an O(m + n) time algorithm to obtain the count. Write a pseudo-code.
- Write a C++ or Java program that uses bit strings to find A ∪ B, A ∩ B, and A – B given subsets A and B of a universal set with 10 elements {0, 1, 2, 3, 4, 5, 6, 7, 8,9}. You have to use bit string Print to the screen set A, set B ( be sure to print out the name of the sets), as well as the set operation results(be sure to print out the name of the operations). The program requires that elements of subsets A and B are from user input. You can make the assumption that user input numbers are within the domain of the set {0, 1, 2, ..., 9} and there is no improper input.Additional requirements and reminders:• The use of STL, templates, and operator overloading is not permitted in any form.• Remember: You must use a bit string when representing a set. You may not use an array ofBoolean variables.• The elements of subset A and subset B must from user input. You may not hardcode the two subsets in your program.Hint:(1) It is a bit easier to program if we construct the bit string of a set…def reverse_sentence(s: str) -> str:"""This means that in the string 'ATest string!', there are in fact only twowords: 'A' and 'Test string!'. Again, keep in mind that words start with acapital letter and continue until the next capital letter or the end of thestring, which is why we consider 'Test string!' as one word.This function will reverse each word found in the string, and return a newstring with the reversed words, as illustrated in the doctest below.>>> reverse_sentence('ATest string!')'A!gnirts tseT'""" please don't use any list function or import just basic if and loop function and also please do this code in pythonc++ , A character string is given. What is the minimum number of characters you need to change to make the resulting string of identical characters? Solve this task in 3 different manners using : sets, maps and deque ( 3 different codes ) Input output 69pop66 4 1+2=12 4
- Exercise 11.10. Two words are “rotate pairs” if you can rotate one of them and get the other (see rotate_word in Exercise 8.12). Exercise 8.12. ROT13 is a weak form of encryption that involves “rotating” each letter in a word by 13 places. To rotate a letter means to shift it through the alphabet, wrapping around to the beginning if necessary, so ’A’ shifted by 3 is ’D’ and ’Z’ shifted by 1 is ’A’. Write a function called rotate_word that takes a string and an integer as parameters, and that returns a new string that contains the letters from the original string “rotated” by the given amount. For example, “cheer” rotated by 7 is “jolly” and “melon” rotated by -10 is “cubed”. You might want to use the built-in functions ord, which converts a character to a numeric code, and chr, which converts numeric codes to characters. Potentially offensive jokes on the Internet are sometimes encoded in ROT13. If you are not easily offended, find and decode some of them. Please solve Exercise 11.10 -…In Python, The function concatAltChars takes a string parameter s and a boolean parameter even; the function concatenates together either the even-position characters of s or the odd-position characters of s, depending on whether even is True, or False, respectively. The accumulated string is returned. For example, the even-indexed characters of "HANOVER" are at indexes 0, 2, 4, and 6: H N V R. So, concatAltChars("HANOVER", True) returns the string result "HNVR". But concatAltChars("HANOVER", False) returns the string result "AOE". For example: Test Result s = "goldfinches" print(concatAltChars(s, True)) glfnhs s = "A" print(concatAltChars(s, True)) A s = "A" print(concatAltChars(s, False))JAVA File read write and string manipulation data1.txt(down below) 4,5-t 2,4-d 20-p7int 2D 2nd 2 1080 &c 10-p7int 10th 11-p7int 12-p7int 16-p7int 18-p7int 1st 2,4,5-t 2,4-d 20-p7int 2D 2nd 30-30 3D 3-D 3M 3rd 48-p7int 4-D 4GL 4H 4th 5-p7int 5-T 5th 6-p7int 6th 7-p7int 7th 8-p7int 8th 9-p7int 9th @ @' @- @&M @&P @. @.@.@. @.B. @.B.@. @.C. @.D. @.D.C. @.F. @.F.@.M. @.G. @.H. @.I. @.I.@. @.I.D. @.L. @.L.P. @.M. @.M.@. @.M.D.G. @.N. @.p. @.r. @.R.C.S. @.U. @.U.C. @.V. @.w. @.W.O.L. @/C @/F j54rs54y54d J54rs54yit54 j54rs54yit54s J54rs54ym@n j54rs54ys j54rs54y's J54rs54yvill54 j54rt J54rubb@@l J54rubb@l J54rus@l54m J54rus@l54mit54 j54rvi@ j54rvin j54rvin@ j54rvin54 J54rvis J54rk J54S J54sh J54sh54r J54smin54 j54sp54r J54sp54rs54n J54ss J54ss@ J54ss@b54ll j54ss@k5454d J54ss@lin J54ss@lyn j54ss@my j54ss@mi54s J54ss@myn J54ss@min54 j54ss@nt J54ss54 J54ss54@n j54ss54d J54ss5454 J54ss54y J54ss54lyn J54ss54lt7n J54ss54n j54ss54s J54ssi J54ssy J54ssic@ J54ssi54 kikkl54 kikkl54d kikkl54s…
- Take a sentence and as well as a word/character(s) and return True if the word/character(s) can be found in the sentence. Sample Parameter(s): "chicken", "z" Sample Return: FalseString replacement is read from input. Then, sentence is read from input. If replacement is in sentence, then: Output 'Located at index: ' followed by the index of the last occurrence. Create a string from sentence with the first two occurrences of replacement replaced by '5' and output sentence on a newline.Write a program that benchmarks QuickSort and InsertionSort. You should use at least 5 different data sets and record the performance of each algorithm on the same sets under the same conditions. Write a short report that compares the two algorithms based your results. It is important to include a discussion of the initial states of the data sets in your report. language Java public class week3 {public static void main(String args[]){ //========================================================== //Question 1 testing //================== // Comment on benchmarking for Q1 results // // //========================================================== } static void quickSort(int f[], int p, int q){ if(q-p <= 1) ; //skip else{ int x; int i, j, k; // let x = middle element in f[p..q-1] x = f[(p+q)/2]; //x = f[p]; i = p; j = p; k = q; while(j != k){ if(f[j] == x) j = j + 1; else if(f[j] < x){ //swap f[j] with f[i] int temp; temp = f[j]; f[j] = f[i]; f[i] = temp; j = j + 1; i = i + 1; } else{…