Problem2: Code in python:
#string = "azclololegghaki"
string = input("Enter a string: ")
sub = input("Enter a substring: ")
sub = "lol"
count = 0
ind = 0
for i in string:
count += string.count(sub,ind,ind+3)
ind += 1
print("the number of times substring occures in string
is:",count)

OUTPUT:

Problem2: Code in python:
#s = "wqlnhahjkojlzqkhizkq"
s = input("Enter the string: ")
maxString = ""
maxCount = 0 ;
size = len(s)
string = ""
string += s[0]
i=1;
preChar = s[0]
while(i<size):
if(s[i]>s[i-1]):
string+=s[i]
else:
tempSize = len(string)
if(tempSize>maxCount):
maxString = string
maxCount = tempSize
string = s[i]
else:
string = s[i]
i+=1
print("Longest substring in alphabatical order is:
",maxString)

OUTPUT:


Do in Python Problem 2 Assume s is a string of lower case characters. Write a...
Lab2: Processing Strings Part#1 – Counting Vows Assume s is a string of lower case characters. Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: Number of vowels: 5 Part#2 – Counting Bobs Assume s is a string of lower case characters. Write a program that prints the number of times the string 'bob' occurs...
Write the code in python programming Language String Statistics: Write a program that reads a string from the user and displays the following information about the string: (a) the length of the string, (b) a histogram detailing the number of occurrences of each vowel in the string (details provided below), (c) the number of times the first character of the string occurs throughout the entire string, (d) the number of times the last character of the string occurs throughout the...
Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console. The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string....
C++ 10.4 String to number Write a program that 1.reads in 4 upper case characters Converts each into its Ascii equivalent integer 3.Adds all these numbers together Converts this resulting integer to a string Prints the string. Divides the integer result by 4 Converts this back to an Ascii char prints the char
Please solve in Python.
You would like to set a password for an email account. However, there are two restrictions on the format of the password. It has to contain at least one uppercase character and it cannot contain any digits. You are given a string S consisting of N alphanumerical characters. You would like to find the longest substring of Sthat is a valid password. A substring is defined as a contiguous segment of a string. For example, given...
Write a Python Program Write a program which reads a word, lower-cases all its letters, then prints out a square array where the first row contains the word, and each subsequent line is the previous line circular-shifted one place to the left. Example for entered word word == "MoXiE": moxie oxiem xiemo iemox emoxi Try doing this any way you can. Hint 1: lower-case word, then repeat the following len(word)times: (a) print word, (b) move first char of word to...
Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...
PYTHON You are to write a program that will analyze the frequency of letters in a string. The user will enter a string, your program will output the number of times the letters of the alphabet appear in that string. The user is to enter a string that has upper or lower case letters only, no spaces or other characters. You should convert the string entered to all lowercase letters before you conduct your analysis.
1. Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. Sample String : 'The quick Brow Fox' Expected Output : No. of Upper case characters : 3 No. of Lower case Characters : 12
Question / of 2. Case insensitive string compare: [40 marks/ Write a function that compares two strings while ignoring the case of alphabetical characters. Your program will take two strings as input from the user and use your function to compare them. Assume a maximum C-string size of 1000 characters. Make sure your code works for any input number, not just the test cases. Your code will be tested on other test cases not listed here. Please properly comment your...