class Solution:
def __init__(self, s, N):
self.s = s
self.N = N
def my_func(self,s,N):
count=0
a=[]
for i in range(len(s)):
if(s[i]>='0' and s[i]<='9'):
a.append(i)
a.append(len(s))
i=0
for k in range(len(a)):
for j in s[i:a[k]]:
if(j>='A' and j<='Z'):
if(len(s[i:a[k]])>count):
count=len(s[i:a[k]])
i=a[k]+1
if(count!=0):
return count
else:
return -1
s=input()
N=len(s)
s1=Solution(s,N)
print(s1.my_func(s,N))
Note: In the above program first I have taken input from the user and send it to a function in my class in that function first I have searched for indexes of numbers in string so that I can find the contiguous substrings without numbers and next I have checked whether the substrings have an upper case letter or not. if it has an uppercase letter then i have stored the length of it in count if the next substring is also having uppercase then I have allocated the max length of those substrings in the count and returned it. if the count is 0 then I returned -1

Please solve in Python. You would like to set a password for an email account. However,...
Convert this code written in Python to Java: username=input("please enter a username") password=input("please enter a password:") def is_a password(password): count_uppercase, count_lowercase= 0, 0 for characters1 in password: if characters1.isupper(): count_uppercase += 1 if characters1.islower(): count_lowercase += 1 is_password is good = True if len(password) <= 7: print "Passwords must be at least 8 characters long" is_password is good = False if count_uppercase < 1: print "Your password must...
Write a program that inputs a string from the user representing a password, and checks its validity. A valid password must contain: -At least 1 lowercase letter (between 'a' and 'z') and 1 uppercase letter (between 'A' and 'Z'). -At least 1 digit (between '0' and '9' and not between 0 and 9). At least 1 special character (hint: use an else to count all the characters that are not letters or digits). -A minimum length 6 characters. -No spaces...
LANGUAGE: JAVA
An online coin dealer offers bags of coins that are guaranteed to contain at least one full set. Given a string comprised of lowercase letters in the range ascii[a-z), where each letter represents a coin type, determine the length of the shortest substring that contains at least one of each type of coin. Example: coins = dabbcabcd The list of all characters in the string is (a, b, c, d]. Two of the substrings that contain all letters...
Please use Python
def findSubstrings(s):
# Write your code here
Consider a string, s = "abc". An alphabetically-ordered sequence of substrings of s would be {"a", "ab", "abc", "b", "bc", "c"}. If the sequence is reduced to only those substrings that start with a vowel and end with a consonant, the result is {"ab", "abc"}. The alphabetically first element in this reduced list is "ab", and the alphabetically last element is "abc". As a reminder: • Vowels: a, e, i,...
8.4 in python
function that checks whether a string is a valid password. Suppose the pas rules are as follows: . A password must have at least eight characters - A password must consist of only letters and digits. ■ A password must contain at least two digits. Write a program that prompts the user to enter a password and displays valid password if the rules are followed or invalid password otherwise (Occurrences of a specified character) Write a function...
Part 1: Is this Crazy Password Valid? A good password (in this strange system) should have the following properties: Rule 1: The password should be between 4 and 25 characters inclusive, starting with a letter. Rule 2. The password should not be contained in a list (selected by the user) that contains passwords commonly used by many people thus making these passwords easy to guess. Comparisons with passwords from the list of common passwords should be case insensitive. For example,...
Using Python
INST-FS-IAD-PROD.INS LAB1 Lab: Create User Account 2. get-password() #promt the user and create password, check the password fits the requirement USE the EXACT file names! Create a user login system. Your code should do the following: 3, create-user_name() #use this function to create the user name 1.Create your user database called "UD.txt", this should be in CSV format 4, write-file() #user this function to save the user name and password into "UD.txt" Deliverables: Sample: the data you saved...
PLEASE CODE IN PYTHON Run-length encoding is a simple compression scheme best used when a data-set consists primarily of numerous, long runs of repeated characters. For example, AAAAAAAAAA is a run of 10 A’s. We could encode this run using a notation like *A10, where the * is a special flag character that indicates a run, A is the symbol in the run, and 10 is the length of the run. As another example, the string KKKKKKKKKKKKKBCCDDDDDDDDDDDDDDDKKKKKMNUUUGGGGG would be encoded...
In this question you have to write a C++ program to convert a date from one format to another. You have to write a complete program consisting of a main() function and a function called convertDate(). The function receives a string of characters representing a date in American format, for example December 29, 1953. The function has to convert this date to the international format. For example: If the string December 29, 1953 is received, the string that the function...