MonsterScripter

CodinGame_2023_08_23__23_24_00__e_letter.c

Aug 23rd, 2023 (edited)
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdbool.h>
  5.  
  6. /**
  7.  * Objective:
  8.  * Declan: Who the hell are you?
  9.  *
  10.  * Walt: You know. You all know exactly who I am. Say my name.
  11.  *
  12.  * Declan: What? I don't have a damn clue who the hell you are.
  13.  * Walt: Yeah, you do. I'm the cook. I'm the man who killed Gus Fring.
  14.  *
  15.  * Declan: Bullshit. Cartel got Fring.
  16.  *
  17.  * Walt: Are you sure? That's right. Now. Say my name.
  18.  *
  19.  * Declan: You're ............ ?
  20.  *
  21.  * Entrée:
  22.  * Heisenberg
  23.  *
  24.  * Sortie:
  25.  * 4
  26.  *
  27.  * Contraintes:
  28.  * Tip: output the count of letters 'e' case independently plus one
  29.  *
  30.  * Exemple:
  31.  * Entrée:
  32.  * Heisenberg
  33.  * Sortie:
  34.  * 4
  35.  */
  36.  
  37. int main()
  38. {
  39.     char x[10001];
  40.     scanf("%[^\n]", x);
  41.     int result = 0;
  42.     for (int i=0; i<strlen(x); i++) {
  43.         if (x[i] == 'e' || x[i] == 'E') {
  44.             result++;
  45.         }
  46.     }
  47.     printf("%d\n", result+1);
  48.     return 0;
  49. }
  50.  
Add Comment
Please, Sign In to add comment