Given an email address, extract the username by eliminating the and the subsequent characters to form a new string Str. Add the length of at the end of Str to form a resultant string R
Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as these contribute to the standard
output
42 €
Constraints:
Length of email address 100
Username U can contain an alphanumeric string
Input Format:
The input contains the email address.
Output Format:
The output contains R.
Sample Input1; [email protected]
Sample Output1: AbcDefGhi9
Explanation1:
By eliminating "@" from the email address '[email protected], the user name U becomes 'AbcDefGhi", and the length of U is 9. Thus, the output is AbcDefGhi9.
Sample Input2: [email protected]
Sample Output2: XYZ123abc510
Explanation 2:
The user name here is XYZ123abc5, and the length of the
Answers
Answered by
3
Answer:
username by eliminating the and the subsequent characters to form a new string Str. Add the length of at the end of Str to form a resultant string R
Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as
Sample Input1; AbcDefGhi@
Answered by
4
Answer:
email=input("enter the email\n")
# original string is printed
print("The original string is : " + str(email))
# slicing domain name using slicing
res = email[:email.index('@') ]
# finding the length of the sliced string
length_of_the_string=len(res)
final_string=res+str(length_of_the_string)
# printing result
print("The extracted username with lenght is : " + str(final_string))
Explanation:
- Initially, a string is taken as input from the user.
- Then it is sliced until the cursor meets the character "@".
- The content after the @ is cut out and the remaining string is taken for consideration.
- The length of the remaining string is concatenated with the length for the result.
#SPJ2
Similar questions