leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
2490.cpp (335B)
0 class Solution {
1 public:
2 bool isCircularSentence(const string &sentence) const {
3 char prev = sentence.back();
4 stringstream ss(sentence);
5 string word;
7 while (ss >> word) {
8 if (word.front() != prev) return false;
9 prev = word.back();
10 }
12 return true;
13 }
14 };