Codeforces 997B Two-gram Solution

Problem Name: B. Two-gram

Problem Link: 997B. Two-gram 

Solution on GitHub: 977B. Two-gram

Codeforces 977B Two Gram Solution


// Dabananda Mitra, CSE (2019-20), ISTT.
// Email: imdmitra@outlook.com

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector vi;

#define TLE                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);

void Solution() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  map m;
  for (int i = 0; i < s.length() - 1; i++) {
    m[s.substr(i, 2)]++;
  }
  map::iterator it;
  int max = 0;
  string ans;
  for (it = m.begin(); it != m.end(); it++) {
    if (it->second > max) {
      ans = it->first, max = it->second;
    }
  }
  cout << ans << "\n";
}

int main() {
  TLE;
  Solution();
  return 0;
}


Previous solution of codeforces

1. Codeforces 1800 A. Is It a Cat solution in C++

2. 469A - I Wanna Be the Guy Codeforces || Codeforces 469A - I Wanna Be the Guy Solution

3. 61A - Ultra-Fast Mathematician Codeforces || Codeforces 61A - Ultra-Fast Mathematician Solution

4. 271A - Beautiful Year Codeforces || Codeforces 271A - Beautiful Year Solution

5. 41A - Translation Codeforces || Codeforces 41A - Translation Solution


Social Links:


Codeforces 977b Two Gram Solution

Tags:

codeforces round 479
ab balance codeforces
ab string codeforces
split it codeforces
yes or yes codeforces
good numbers codeforces
unique number codeforces
codeforces com problemset submit
Keyword
two-gram codeforces solution
two gram codeforces solution
bit++ codeforces solution in c
Keyword
cf 97b solution review
now solutions hyaluronic acid firming serum
pressed serum
iherb axis y
now foods solutions hyaluronic acid firming serum 1 fl oz
elizavecca hell pore bifida premium ample
iherb anti aging
elizavecca website
Keyword
cf 97b solution pdf
cf 97b solution pdf free download
cf 97b solution pdf download
*cf 97b solution
cf97b * solution


Next Post Previous Post
No Comment
Add Comment
comment url