結果

問題 No.495 (^^*) Easy
ユーザー mannshi222
提出日時 2022-04-28 20:29:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 67,812 KB
最終ジャッジ日時 2025-01-28 22:12:50
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <string>

using namespace std;

int main()
{
	char S[100000+1];
	cin >> S;

	/*
	   (^^*)が左向きで、
(*^^)が右向きです。
*/

	
	char *s;
	int cnt = 0;

	s = S;
	cnt = 0;
	while( ( s = strstr( s, "*)") )!= NULL ) {
		cnt++;
		s+=1;
	}
	cout << cnt << " ";

	cnt = 0;
	s = S;
	while( ( s = strstr( s, "(*") )!= NULL ) {
		cnt++;
		s+=1;
	}
	cout << cnt << endl;

	return 0;
}
0