

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen ("GAME.INP", "r", stdin);
freopen ("GAME.OUT", "w", stdout);
string s; cin >> s;
int a = 0, b = 0;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == 'D') a++;
else if (s[i] == 'N') b++;
}
cout << a << " " << b;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("GAME.INP", "r", stdin);
freopen("GAME.OUT", "w", stdout);
string s; cin >> s;
int a = 0, b = 0, i = 0;
while (i < s.size())
{
if (s[i] == 'D') a++;
else if (s[i] == 'N') b++;
i++;
}
cout << a << " " << b;
}
Chúc bn học tốt!
$\color{Red}{\triangleright \triangleright\ \color{ Red}{\text{ThienPhuc123} \triangleleft \triangleleft}}$
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
1887
26084
1060
fan kieutong
968
6553
540
Chào bạn!
968
6553
540
Có gì không?
133
85
105
+))