zoukankan      html  css  js  c++  java
  • 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 (l)th position to the (r)th 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 (4 sim Q+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[l dots r]).

    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


    ( ext{Subtask1(50%)})(1le n le 100)
    ( ext{Subtask2(50%)})(1le n le 500000, 1 le Q le 20000)

    Sample Code


    Code is not available!
    
  • 相关阅读:
    vue-router路由器的使用
    组件间数据传递
    引用模块和动态组件
    vue自定义全局和局部指令
    vue实例的属性和方法
    vue生命周期以及vue的计算属性
    vue 发送ajax请求
    安装vue-cli脚手架
    vue指令详解
    scrapy-redis组件的使用
  • 原文地址:https://www.cnblogs.com/jiupinzhimaguan/p/13817389.html
Copyright © 2011-2022 走看看