Demo library
Project description
library_mult
Consider a string containing lowercase characters from the Portuguese alphabet. You can perform two types of operations on this string:
Concat a lowercase character from the Portuguese alphabet at the end of the string.
Remove the last character from the string. If the string is empty, it will remain empty.
Given an integer k and two strings s and t, determine if you can convert s to t using exactly k operations described above on s. If possible, the program prints 'yes', otherwise it prints 'no'.
For example, string s = [a, b, c] and string t = [d, e, f]. The number of moves k = 6. To convert s to t, we first remove all characters using 3 moves. Then we concatenate each of the characters of t in the order. In the sixth move, you will have the expected string s. If more movements are available than necessary, they can be eliminated by performing multiple removals on an empty string. If there are fewer movements, it would not be possible to create the new string.
Input format The first line contains the string s, the starting string. The second line contains the string t, the desired string. The third line contains an integer k, the number of operations.
Constrains a) 1 <= | s | <= 100 b) 1 <= | t | <= 100 c) 1 <= k <= 100 d) s and t consists of lowercase letters of the Portuguese alphabet, ascii [a-z]
Output format Print 'yes' if you can get the string t by executing exactly k operations on the string s, and print 'no' otherwise.
Example 1 bla bla bla bla blablabcde 8 yes
Explanation It took 5 operations to reduce the string "blablablabla" to "blablab". Then, 3 concatenation operations (c, d, e) were needed to obtain the string "blablabcde". In this way, as it was possible to convert s to t using exactly k = 8 operations, the program printed "yes".
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for concat_remove_library-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a954d30e69b60e8f9d3a7026b2aa5aaa61b95493fdcf3730aeb0e371d8956ff8 |
|
MD5 | ee4dd6f3ad5fd4b23ee90c20011228b9 |
|
BLAKE2b-256 | 0a050e7affde39be9aba0c842fb6bdce0f9f9f6d1a2092ab7723212d9b43f5b3 |
Hashes for concat_remove_library-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e183b19820a112c93eabb868d836c9eaa4b32e36ef748450cec3bd141154bc3 |
|
MD5 | e31cba8be7ee2e6b4e5be4150210b533 |
|
BLAKE2b-256 | 879277ae3dac650485142675685b4c469bbdc2bb38d034646a96826724f6c09e |