How to measure duty-cycle with Input Capture from STM32F103C8T6?
The process is described in detail in the Reference Manual, look for PWM input mode.

Don't forget to check the input pin in the pin definitions table of the Datasheet. If it's not marked as 5 Volt Tolerant (FT in the I/O Level column), then place a suitable voltage divider between the signal source and the input pin.