Byang is creating an account on Toph. He needs your help to create a strong password. Byang will giv…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
@corrupted_brain try to solve it using python by yourself first. If you fail then you can ask us. Just don’t seek help before trying. You can’t improve that way. Easy problems are basic problems for beginners to try and learn. If you fail, then you can always free to ask here.
However, to take strings as input s = input() should do. for example:
>>> input()
it is a string
'it is a string'
>>> s = input()
sample string
>>> s
'sample string'
>>> s[0]
's'
>>> s[1]
'a'
>>> len(s)
13
>>> for i in s:
... ... print(i)
...
s
a
m
p
l
e
s
t
r
i
n
g
This example should help you to learn about strings.
I actually checked the output for your most recent submission. It seems you are printing an extra unreadable character at the end. So something is not right in the code I would assume.
Also, you don’t need to keep track of that flag and print conditionally. You can assume that the input will always be within the constraints.
@Burn_Fireblaze, you should not share your solve if your code have already got accepted.
Please remove this type of posts that you have made, from everywhere.
Why not try solving this problem using two character arrays? One for the input and the other where you build the password.
That way, you are less likely to make mistakes in the code.
For each character in the input array, you will put the necessary characters at the end of the output character array. You can track the “end” of this array using an integer index. At the very, just put a ‘\0’ (null character) to make it a string.