1Input: strings: "XXXXZY", "XXY", "XXZ"
2Output: XXXXZY is interleaved of XXY and XXZ
3The string XXXXZY can be made by
4interleaving XXY and XXZ
5String: XXXXZY
6String 1: XX Y
7String 2: XX Z
8
9Input: strings: "XXY", "YX", "X"
10Output: XXY is not interleaved of YX and X
11XXY cannot be formed by interleaving YX and X.
12The strings that can be formed are YXX and XYX
1#A string is a type of data. There are many data types. It can be manipulated.
2#It can be storerd as a variable
3myString = "Hello world"
4#WE can print it:
5print(myString)
6#You can append it to arraY:
7myArr = []
8myArr.append(myString)
9#You can find the index of a character in a string:
10H = myString[0]
11#You can use methods on it:
12lowercase = myString.lower()
13#You can convert it into a integer provided it is a numerical string
14myInt = int(myString)
15#So thats the basics, hope i haven't left anything out.
1#include <iostream>
2int main()
3{
4 using namespace std;
5
6 char name[20]; //declaring string 'name'
7
8 cin.getline(name, sizeof(name)); //taking string input
9 cout << name << endl; //printing string
10 return 0;
11}
12
1
2x = str("s1") # x will be 's1'
3
4y = str(2) # y will be '2'
5
6z = str(3.0) # z will be '3.0'
7