Submission
Status:
[-SSS][-][-][-][-]
Subtask/Task Score:
{0/20}{0/20}{0/20}{0/20}{0/20}
Score: 0
User: KanemiyaKana
Problemset: นก
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-03 16:52:27
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main ()
{
string input;
string output = "";
int amount;
cin >> input;
if (input.length() > 100000 || input.length() < 1)
{
cout << "input is longer than supported.";
return 0;
}
cin >> amount;
if (amount > 100000 || amount < 1)
{
cout << "input is longer than supported.";
return 0;
}
for (int i = 0; i < input.length(); i++)
{
if (!isalpha(input[i]))
{
cout << "Input must be alphabetical.";
return 0;
}
}
for (int i = 0; i < amount; i++)
{
int count = 0;
int start;
int end;
char c;
cin >> start >> end >> c;
if (!isalpha(c))
{
cout << "Character is not an alphabet.";
return 0;
}
if (start < 1)
{
cout << "Not in range of input.";
return 0;
}
if (end > input.length())
{
cout << "Not in range of input.";
return 0;
}
for (int j = start - 1; j < end; j++)
{
if (c == input[j])
{
count++;
}
}
string strcount = to_string(count);
output += strcount;
output += "\n";
}
cout << output;
}