Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a program to calculate the length of a string without using built-in functions.

Medium

Problem Statement

Implement a program to calculate the length of a string without using built-in functions.

Sample Input

std::string str = "Hello World";

Sample Output

Length of the string = 11

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <iostream> #include <string> int main() { std::string str = "Hello World"; // Logic to calculate string length return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
std::string str = "Hello World";
Expected Output
Length of the string = 11