This is an example of a string: abcde123#ijklmn0pq
In that string I need to print out only the numbers (the 123
sequence), and remove the letters (from both left and right) and the hashtag (#
) to be removed as well.
The hashtag (#
) is always included in the string.
The hashtag (#
) is always positioned to the right of the characters that need to be printed;
The hashtag (#
) is always positioned to the left of the characters that need to be removed;
Therefore, the hashtag (#
) can be used as a guide to remove the letters from the Right
The number of characters in the beginning is always equal to 5 (constant) (to be removed);
The number of characters in the middle is always different (variable) (to be printed);
The number of characters in the right is always different (variable) (to be removed);
Here's another string example, similar to the first one: !!@@$IMPORTANT#=-=whatever
The characters that need to be printed are the word "IMPORTANT
"
As with the first example, what's on the left side of the hashtag (#) needs to be printed, but it's important to print only the "IMPORTANT
" word, without the special characters "!!@@$".