Last updated 1 month ago
Time Complexity: O(1)O(1)O(1)
This is a purely give-away question. Nothing to say. Just print the first character of your input suffices.
#include <string.h> #include <stdio.h> #define MAX_LEN 100 int main() { char line[MAX_LEN]; if (fgets(line, MAX_LEN, stdin)) { line[strcspn(line, "\n")] = 0; } putchar(line[0]); }