19 lines
423 B
C++
19 lines
423 B
C++
#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!");
|
|
}
|