// C# 7.3
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace Rextester
{
public class Program
public static void Main(string[] args)
var crypted = "";
for (int i = 0; i < CaesarCipher.Ru.Length; i++)
Console.WriteLine(CaesarCipher.Decode(i, crypted));
}
class CaesarCipher
public static readonly string Ru = "";
public static readonly string RuD = "";
private static readonly int defaultStep = 3;
public static CaesarEncrypted Encode(int step, string source, Func<string, string> translate)
string translatedData = translate(source);
var stringBuilder = new StringBuilder();
foreach (char c in translatedData.ToLower())
stringBuilder.Append(RuD[Ru.IndexOf(c) + step]);
return new CaesarEncrypted(step, stringBuilder.ToString());
public static CaesarEncrypted Encode(int step, string source)
return Encode(step, source, x => x);
public static string Decode(CaesarEncrypted source)
var step = source.Step;
return Encode(-step + Ru.Length, source.ToString(), x => x);
public static string Decode(int step, string source)
return Encode(-step + Ru.Length, source, x => x);
class CaesarEncrypted : IEnumerable, IEnumerable<char>
public int Step { get; set; }
public string Data { get; set; }
public CaesarEncrypted(int step, string initData)
Step = step;
Data = initData;
public CaesarEncrypted(string initData) : this(int.MaxValue, initData)
{}
public IEnumerator<char> GetEnumerator()
foreach (char c in Data)
yield return c;
IEnumerator IEnumerable.GetEnumerator() => (IEnumerator<char>)GetEnumerator();
public override string ToString() => Data;
public static implicit operator string(CaesarEncrypted source) => source.ToString();
#include <iostream>
#include <stack>
using namespace std;
void solve(string &s){
stack<char> cur;
for(int i = 0; i < s.size(); i++){
if(!cur.empty() && ((cur.top() == '(' && s[i] == ')') || (cur.top() == '{' && s[i] == '}') || (cur.top() == '[' && s[i] == ']')))
cur.pop();
else cur.push(s[i]);
if(cur.empty()) cout << "YES";
else cout << "NO";
signed main() {
string str;
cin >> str;
solve(str);
// C# 7.3
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
var crypted = "";
for (int i = 0; i < CaesarCipher.Ru.Length; i++)
Console.WriteLine(CaesarCipher.Decode(i, crypted));
}
}
class CaesarCipher
{
public static readonly string Ru = "";
public static readonly string RuD = "";
private static readonly int defaultStep = 3;
public static CaesarEncrypted Encode(int step, string source, Func<string, string> translate)
{
string translatedData = translate(source);
var stringBuilder = new StringBuilder();
foreach (char c in translatedData.ToLower())
{
stringBuilder.Append(RuD[Ru.IndexOf(c) + step]);
}
return new CaesarEncrypted(step, stringBuilder.ToString());
}
public static CaesarEncrypted Encode(int step, string source)
{
return Encode(step, source, x => x);
}
public static string Decode(CaesarEncrypted source)
{
var step = source.Step;
return Encode(-step + Ru.Length, source.ToString(), x => x);
}
public static string Decode(int step, string source)
{
return Encode(-step + Ru.Length, source, x => x);
}
}
class CaesarEncrypted : IEnumerable, IEnumerable<char>
{
public int Step { get; set; }
public string Data { get; set; }
public CaesarEncrypted(int step, string initData)
{
Step = step;
Data = initData;
}
public CaesarEncrypted(string initData) : this(int.MaxValue, initData)
{}
public IEnumerator<char> GetEnumerator()
{
foreach (char c in Data)
yield return c;
}
IEnumerator IEnumerable.GetEnumerator() => (IEnumerator<char>)GetEnumerator();
public override string ToString() => Data;
public static implicit operator string(CaesarEncrypted source) => source.ToString();
}
}
#include <iostream>
#include <stack>
using namespace std;
void solve(string &s){
stack<char> cur;
for(int i = 0; i < s.size(); i++){
if(!cur.empty() && ((cur.top() == '(' && s[i] == ')') || (cur.top() == '{' && s[i] == '}') || (cur.top() == '[' && s[i] == ']')))
cur.pop();
else cur.push(s[i]);
}
if(cur.empty()) cout << "YES";
else cout << "NO";
}
signed main() {
string str;
cin >> str;
solve(str);
}