#pragma once

#include <string>
#include <vector>
#include <iostream>
#include <tuple>


namespace hack::string
{
  using v_str = std::vector<std::string>;
  using v_int_str = std::vector<int>;

  template<typename T>
  v_str split_str(const std::string& str, T t)
  {
    v_str v;

    std::string::size_type begin = 0;
    std::string::size_type end = str.find_first_of(t);
    
    while(end != std::string::npos)
    {
      v.emplace_back(str.substr(begin, end - begin));
      begin = ++end;
      end = str.find_first_of(t, begin);
    }
    v.emplace_back(str.substr(begin));

    return v;
  }

  template<typename T>
  v_int_str split_stoi(const std::string& str, T t)
  {
    v_int_str v;

    std::string::size_type begin = 0;
    std::string::size_type end = str.find_first_of(t);
    
    while(end != std::string::npos)
    {
      v.emplace_back(std::stoi(str.substr(begin, end - begin)));
      begin = ++end;
      end = str.find_first_of(t, begin);
    }
    v.emplace_back(std::stoi(str.substr(begin)));

    return v;
  }
}
