Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string word;
- getline(cin, word);
- string ww = word.substr(0, 1);
- int z = 0, y = 0;
- for (int i = 0; i < word.size(); i++)
- {
- for (int k = 0; k < word.size(); k++)
- {
- if (word.substr(i, 1) == word.substr(k, 1))
- {
- y += 1;
- }
- }
- if (y > z)
- {
- z = y;
- ww = word.substr(i, 1);
- }
- y = 0;
- }
- cout << ww;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement