another kata
This commit is contained in:
1 parent
dc65b6b3da
commit
9d507a276d
1 file changed
+18
@@ -0,0 +1,18 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
std::string reverse_letter(const std::string &str)
|
||||
{
|
||||
std::string alphabet ("abcdefghijklmnopqrstuvwxyz");
|
||||
std::string result ("");
|
||||
for (int i = str.length() - 1; i >= 0; i--){
|
||||
if (alphabet.find(str[i]) != std::string::npos){
|
||||
result.push_back(str[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(){
|
||||
std::cout << reverse_letter("Ba3rti1bo0y!");
|
||||
}
|
||||
Reference in new issue
Block a user