+ 1
string handling.
A sentence is entered from the keyboard in which words are separated by spaces. Determine how many words in this sentence begin and end with the same char example: 1. "my friend did not do this". Output: did 2. "He speaks with his aunt" . Output: speaks
4 Answers
+ 3
Something like this?
#include <string>
#include <iostream>
int main()
{
std::string text;
while(std::cin >> text)
{
if(text.size() > 1 && (text.at(0) == text.at(text.size() - 1)))
std::cout << text << "\n";
}
}
+ 2
#Python rules
print(*[i for i in input().split() if i[0].lower()==i[-1].lower()])
+ 2
This question is terribly worded. "one letter" implies a single character. As per your example, the question should read "the same letter"
+ 1
wow. many thanks