Simple string manipulation (string)

Description


Give you a string S with a length of n and only lowercase letters (subscripts start from 1 to n), perform the following two operations Q times:
1 i c: Replace the character at position i in the string S with the character c;
2 l r: The number of different characters from the lth position to the rth position in the query string S.

Format


Input

The first line contains an integer n, which represents the length of the string S.
The second line contains a string S of length n, containing only lowercase letters.
The third line contains an integer Q, which represents the number of operations.
In line 4Q+3, each line describes one of the above two operations.

Output

For each operation 2, the output line contains an integer, which represents the number of different characters in S[lr].

Sample


Input

7
abcdbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7

Output

3
1
5

Hint


Subtask1(50%)1n100
Subtask2(50%)1n500000,1Q20000

Sample Code


Code is not available!
posted @   Sample_Test  阅读(118)  评论(0编辑  收藏  举报
编辑推荐:
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
· 现代计算机视觉入门之:什么是图片特征编码
· .NET 9 new features-C#13新的锁类型和语义
阅读排行:
· Sdcb Chats 技术博客:数据库 ID 选型的曲折之路 - 从 Guid 到自增 ID,再到
· 语音处理 开源项目 EchoSharp
· 《HelloGitHub》第 106 期
· Spring AI + Ollama 实现 deepseek-r1 的API服务和调用
· 使用 Dify + LLM 构建精确任务处理应用
点击右上角即可分享
微信分享提示