Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
util.hpp
[詳解]
1#pragma once
2#include"../../kyopro_library/template.hpp"
3
4/// @brief 文字列を数列に変換する
5vector<int> StringToVi(const string& s, bool lower=true) {
6 vector<int> ret(s.size());
7 REP(i,s.size()) ret[i]=(lower ? s[i]-'a' : s[i]-'A');
8}
9
10/// @brief 入力から文字列を受け取って数列に変換する
11vector<int> ReadString(bool lower=true) {
12 string s; cin>>s;
13 return StringToVi(s);
14}
15
16/// @brief 数列を文字列に変換する
17string ViToString(const vector<int>& a, bool lower=true) {
18 string ret;
19 REP(i,a.size()) ret.push_back(lower ? char('a'+a[i]) : char('A'+a[i]));
20 return ret;
21}
#define REP(i, n)
Definition template.hpp:5
vector< int > ReadString(bool lower=true)
入力から文字列を受け取って数列に変換する
Definition util.hpp:11
string ViToString(const vector< int > &a, bool lower=true)
数列を文字列に変換する
Definition util.hpp:17
vector< int > StringToVi(const string &s, bool lower=true)
文字列を数列に変換する
Definition util.hpp:5