- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ program to convert kth character to lowercase
Suppose we have a string S with N characters. S contains only three types of characters 'A', 'B' or 'C'. We also have another integer K. We have to print S after lowercasing the Kth character in it.
So, if the input is like K = 2; S = "AABACC", then the output will be "AaBACC"
Steps
To solve this, we will follow these steps −
S[K - 1] = S[K - 1] + 32 return S
Example
Let us see the following implementation to get better understanding −
#include <bits/stdc++.h> using namespace std; string solve(int K, string S){ S[K - 1] = S[K - 1] + 32; return S; } int main(){ int K = 2; string S = "AABACC"; cout << solve(K, S) << endl; }
Input
"AABACC"
Output
AaBACC
- Related Articles
- C# Program to Convert Character case
- Swift Program to Convert a String to Lowercase
- Program to find the kth character after decrypting a string in C++
- Write a C program to convert uppercase to lowercase letters without using string convert function
- Java program to convert a string to lowercase and uppercase.
- Golang Program to convert Uppercase to Lowercase characters, using binary operator.
- Java Program to Convert Character to String
- Golang Program to Convert Character to String
- C Program to convert first character uppercase in a sentence
- C# Program to convert first character uppercase in a sentence
- Convert text to lowercase with CSS
- C# Program to generate random lowercase letter
- How to convert string to lowercase in TypeScript?
- Java program to convert a character array to string
- How to convert Python dictionary keys/values to lowercase?

Advertisements