insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Count how many alphabets are before 'm' and after 'm' in a given string.

Count how many alphabets are before 'm' and after 'm' in a given string.

Difficulty: Medium

Phase: 5 · Strings

XP Reward: 20 XP

Topics: Strings, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Take a lowercase alphabetic string and count letters before 'm' and letters after 'm' (excluding 'm') in format 'Before: B, After: A'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: lemon

Output: Before: 2, After: 2

Explanation: Sample execution for input lemon