Write a C++ program to check if a string 'yt' appears at index 1 in a given string. If it appears return a string without 'yt' otherwise return the original string
- برمجة سي بلس بلس
- برمجة
- 2021-05-11
- MarwaMohammed
الأجوبة
#include <iostream>
using namespace std;
string test(string str)
{
return str.substr(1, 2)=="yt" ? str.erase(1, 2) : str;
}
int main()
{
cout << test("Python") << endl;
cout << test("ytade") << endl;
cout << test("jsues") << endl;
return 0;
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
