Untitled
unknown
c_cpp
2 years ago
788 B
4
Indexable
using namespace std; #include <iostream> int main() { /* setlocale(LC_ALL, "Russian"); int n; cin >> n; cout << "лапок - " << n * 4 << endl << "хвостов - " << n << endl << "усов - " << n * 30; */ setlocale(LC_ALL, "Russian"); int n; char a; int countw = 0; int countb = 0; int countg = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (a == 'b') { countb += 1; } if (a == 'w') { countw += 1; } if (a == 'g') { countg += 1; } } cout << "черных - " << countb << endl; cout << "белых - " << countw << endl; cout << "зеленых - " << countg << endl; }
Editor is loading...